Claus Assmann wrote:
> I'm getting a crash in sha1_block_data_order_ssse3() but currently
> I don't know how to debug this further as I'm not very familiar
> with the internals... Any suggestions for tracking this down are
> appreciated, e.g., is it something in the application or in OpenSSL?
> The problem is 100% reproducible in this application (SMTP server)
> but it doesn't happen in others (e.g., sendmail 8) using the same
> OpenSSL setup. I found some other instances of this crash online
> but seemingly without conclusion what's actually wrong.
> 
> Here's some information:
> 
> $ openssl version -a
> OpenSSL 1.0.1e 11 Feb 2013
> built on: Fri Dec 13 06:33:28 PST 2013
> platform: debug-BSD-x86_64
> options:  bn(64,64) rc4(16x,int) des(idx,cisc,16,int) idea(int) blowfish(idx) 
> compiler: gcc -DOPENSSL_THREADS -pthread -D_THREAD_SAFE -D_REENTRANT 
> -DDSO_DLFCN -DHAVE_DLFCN_H -DL_ENDIAN -DTERMIOS -g -Wall -DOPENSSL_IA32_SSE2 
> -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM 
> -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM 
> -DWHIRLPOOL_ASM -DGHASH_ASM
> OPENSSLDIR: "/home/ca/FreeBSD"
> 
> Program received signal SIGBUS, Bus error.
> sha1_block_data_order_ssse3 () at sha1-x86_64.s:1328
> 1328            movdqa  %xmm0,0(%rsp)
> rsp            0x800736048      0x800736048

Update for *broken* patch that luckily stuck in ML approval queue (this patch is
wrong, *do not apply* - %ebp/%rbp is used/clobbered inside of the function):

*Something* on your BSD system breaks amd64 SystemV ABI:

=== http://x86-64.org/documentation/abi.pdf (page 17) ===
3.2.2     The Stack Frame
...
    The end of the input argument area shall be aligned on a 16 (32, if __m256
is passed on stack) byte boundary. In other words, the value (%rsp + 8) is
always a multiple of 16 (32) when control is transferred to the function entry
point. The stack pointer, %rsp, always points to the end of the latest allocated
stack frame.
=== cut ===

At the beginning of this function, OpenSSL pushes 3*8-byte register on stack,
and then subtract 64 from %rsp, so at this moment %rsp must be 16-byte aligned
--- *that is, if caller adheres to ABI*. It is *not* - so your
OS/compiler/toolchain/libraries *breaks* ABI (and should be fixed).

And, as your linux system adheres amd64 ABI, there are no problem for openssl.

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       openssl-dev@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to