NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

port-sparc/57594: openssl speed crashes on sparcv8

>Number:         57594
>Category:       port-sparc
>Synopsis:       openssl speed crashes on sparcv8
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    port-sparc-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Aug 28 16:30:00 +0000 2023
>Originator:     Martin Husemann
>Release:        NetBSD 10.99.7
The NetBSD Foundation, Inc.
System: NetBSD 10.99.7 NetBSD 10.99.7 (SOMNA) #18: Mon Aug 28 12:28:48 CEST 2023 sparc
Architecture: sparc
Machine: sparc

Running "openssl speed" crashes after some time:

Doing 192 bits  ecdh's for 10s: 18 192-bits ECDH ops in 10.22s
Doing 224 bits  ecdh's for 10s: 12 224-bits ECDH ops in 9.71s
Doing 256 bits  ecdh's for 10s: 8 256-bits ECDH ops in 10.68s
Illegal instruction (core dumped)

and gdb shows it is here:

Program terminated with signal SIGILL, Illegal instruction.
#0  0x00212650 in OPENSSL_cleanse ()
(gdb) x/i $pc
=> 0x212650 <OPENSSL_cleanse+112>:      unknown

which is with a bit more context:

   0x212638 <OPENSSL_cleanse+88>:       be  0x212650 <OPENSSL_cleanse+112>
   0x21263c <OPENSSL_cleanse+92>:       nop 
   0x212640 <OPENSSL_cleanse+96>:       clrb  [ %o0 ]
   0x212644 <OPENSSL_cleanse+100>:      dec  %o1
   0x212648 <OPENSSL_cleanse+104>:      b  0x212634 <OPENSSL_cleanse+84>
   0x21264c <OPENSSL_cleanse+108>:      inc  %o0
=> 0x212650 <OPENSSL_cleanse+112>:      unknown
   0x212654 <OPENSSL_cleanse+116>:      sub  %o1, 8, %o1
   0x212658 <OPENSSL_cleanse+120>:      btst  -8, %o1

and the source is crypto/external/bsd/openssl/dist/crypto/sparccpuid.S
line 406: the "stx" encoded as .word   0xc0720000:

#ifndef ABI64
        subcc   %g0,1,%g1
        ! see above for explanation
        .word   0x83408000      !rd     %ccr,%g1
        cmp     %g1,0x99
        bne     .v8lot

.v9lot: andcc   %o0,7,%g0
        bz      .v9aligned
        stb     %g0,[%o0]
        sub     %o1,1,%o1
        ba      .v9lot
        add     %o0,1,%o0
.align  16,0x01000000
        .word   0xc0720000      !stx    %g0,[%o0]
        sub     %o1,8,%o1
        andcc   %o1,-8,%g0
#ifdef ABI64
        .word   0x126ffffd      !bnz    %xcc,.v9aligned
        .word   0x124ffffd      !bnz    %icc,.v9aligned

I totally fail to see why this can be used w/o #ifdef ABI64 here
(and obviously it can't). Merge botch?



Home | Main Index | Thread Index | Old Index