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" Note: this only happens (so far) on *BSD x86_64 (it doesn't crash on Linux x86_64 which should use the same asm code and of course the application works fine on other platforms or when OpenSSL is configured with no-asm). Here's a gdb session (some parts omitted, it's rather long): Breakpoint 2, SSL_accept (s=0x800c49800) at ssl_lib.c:936 936 if (s->handshake_func == 0) (gdb) n 940 return(s->method->ssl_accept(s)); (gdb) step ssl23_accept (s=0x800c49800) at s23_srvr.c:150 150 unsigned long Time=(unsigned long)time(NULL); (gdb) n 151 void (*cb)(const SSL *ssl,int type,int val)=NULL; (gdb) n 152 int ret= -1; (gdb) n 155 RAND_add(&Time,sizeof(Time),0); (gdb) step RAND_add (buf=0x8007362a0, num=8, entropy=0) at rand_lib.c:155 155 const RAND_METHOD *meth = RAND_get_rand_method(); (gdb) step RAND_get_rand_method () at rand_lib.c:94 94 if (!default_RAND_meth) (gdb) n 113 return default_RAND_meth; (gdb) n RAND_add (buf=0x8007362a0, num=8, entropy=0) at rand_lib.c:156 156 if (meth && meth->add) (gdb) n 157 meth->add(buf,num,entropy); (gdb) step ssleay_rand_add (buf=0x8007362a0, num=8, add=0) at md_rand.c:217 217 if (crypto_lock_rand) 262 EVP_MD_CTX_init(&m); (gdb) step EVP_MD_CTX_init (ctx=0x8007361a8) at digest.c:126 126 memset(ctx,'\0',sizeof *ctx); ssleay_rand_add (buf=0x8007362a0, num=8, add=0) at md_rand.c:263 263 for (i=0; i<num; i+=MD_DIGEST_LENGTH) (gdb) n ssleay_rand_add (buf=0x8007362a0, num=8, add=0) at md_rand.c:270 270 k=(st_idx+j)-STATE_SIZE; (gdb) n 271 if (k > 0) (gdb) 277 MD_Update(&m,&(state[st_idx]),j); (gdb) 280 MD_Update(&m,buf,j); (gdb) 288 MD_Update(&m,(unsigned char *)&(md_c[0]),sizeof(md_c)); (gdb) 289 MD_Final(&m,local_md); (gdb) Program received signal SIGBUS, Bus error. sha1_block_data_order_ssse3 () at sha1-x86_64.s:1328 1328 movdqa %xmm0,0(%rsp) Current language: auto; currently asm (gdb) where #0 sha1_block_data_order_ssse3 () at sha1-x86_64.s:1328 #1 0x0000000000000070 in ?? () #2 0x0000000000724150 in ?? () #3 0x0000000000000000 in ?? () (gdb) i all rax 0x67452301 1732584193 rbx 0xefcdab89 4023233417 rcx 0x98badcfe 2562383102 rdx 0x10325476 271733878 rsi 0xefcdab89 4023233417 rdi 0x800c39240 34372555328 rbp 0xc3d2e1f0 0xc3d2e1f0 rsp 0x800736048 0x800736048 r8 0x800c39240 34372555328 r9 0x800c3929c 34372555420 r10 0x800c3929c 34372555420 r11 0x45ed00 4582656 r12 0x800c06b20 34372348704 r13 0x800c06ac0 34372348608 r14 0x0 0 r15 0x800736328 34367300392 rip 0x45def1 0x45def1 <sha1_block_data_order_ssse3+129> eflags 0x10206 66054 cs 0x43 67 ss 0x3b 59 ds 0x0 0 es 0x0 0 fs 0x0 0 gs 0x0 0 st0 0 (raw 0x00000000000000000000) st1 0 (raw 0x00000000000000000000) st2 0 (raw 0x00000000000000000000) st3 0 (raw 0x00000000000000000000) st4 0 (raw 0x00000000000000000000) st5 0 (raw 0x00000000000000000000) st6 0 (raw 0x00000000000000000000) st7 0 (raw 0x00000000000000000000) fctrl 0x37f 895 fstat 0x0 0 ftag 0xffff 65535 fiseg 0x0 0 fioff 0x0 0 foseg 0x0 0 fooff 0x0 0 fop 0x0 0 xmm0 {f = {0x0, 0x26800000, 0x0, 0x6668c0}} {f = {2.82784731e+29, -7.11626672e+13, -4.77179622e-28, 6711488.5}} xmm1 {f = {0xe, 0x0, 0x0, 0x0}} {f = {14.9026852, -1.12924267e-34, -3.71112094e-26, -0.00837085675}} xmm2 {f = {0x80000000, 0x0, 0x80000000, 0x0}} {f = {1.83627225e+16, -4.79289421e-38, 1.83627225e+16, -1.5553831e-05}} xmm3 {f = {0x0, 0x0, 0x0, 0x0}} {f = {0, -0, 0, 5.82940161e-43}} xmm4 {f = {0x0, 0x0, 0x0, 0x0}} {f = {1.28569695e-39, 8.03560591e-41, 1.937155e-41, 2.65677221e-39}} xmm5 {f = {0x0, 0x0, 0x0, 0x0}} {f = {0, 1.27995723e-39, 5.14278778e-39, 4.38371001e-40}} xmm6 {f = {0x0, 0x0, 0x0, 0x0}} {f = {9.25571649e-41, 1.56368425e-36, 4.12387433e-34, 1.08664755e-31}} xmm7 {f = {0x0, 0x0, 0x0, 0x0}} {f = {2.05711511e-38, 1.36246568e-39, 8.03560591e-41, 7.59106472e-38}} xmm8 {f = {0x0, 0x0, 0x0, 0x0}} {f = {0, 0, 0, 0}} xmm9 {f = {0x80000000, 0x80000000, 0x80000000, 0x80000000}} {f = { 1.83627225e+16, 1.83627225e+16, 1.83627225e+16, 1.83627225e+16}} xmm10 {f = {0xffc74f8b, 0xa8000000, 0x0, 0x55ca2a00}} {f = { -3715189.5, -9.29393745e+14, 1.67237707e-37, -2.85565491e+09}} xmm11 {f = {0x0, 0x0, 0x0, 0x0}} {f = {0, 0, 0, 0}} xmm12 {f = {0x0, 0x0, 0x0, 0x0}} {f = {0, 0, 0, 0}} xmm13 {f = {0x0, 0x0, 0x0, 0x0}} {f = {0, 0, 0, 0}} xmm14 {f = {0x0, 0x0, 0x0, 0x0}} {f = {0, 0, 0, 0}} xmm15 {f = {0x0, 0x0, 0x0, 0x0}} {f = {0, 0, 0, 0}} mxcsr 0x1fa0 8096 ______________________________________________________________________ OpenSSL Project http://www.openssl.org Development Mailing List openssl-dev@openssl.org Automated List Manager majord...@openssl.org