On Thu, 2008-10-16 at 23:45 +0800, Paul Wise wrote: > Program received signal SIGBUS, Bus error. > [Switching to Thread 0x40020a50 (LWP 11257)] > 0x0000ee28 in tiger_t (str=0x5d987, length=<value optimized out>, > res=0x5d8d4) at ./src/sh_tiger1.c:284 > 284 tiger_compress_macro(str, res); > (gdb) bt full > #0 0x0000ee28 in tiger_t (str=0x5d987, length=<value optimized out>, > res=0x5d8d4) at ./src/sh_tiger1.c:284
After replacing tiger_compress_macro with the relevant code, I get this: Program received signal SIGBUS, Bus error. [Switching to Thread 0x40020a50 (LWP 11348)] 0x0000ee28 in tiger_t (str=0x5d987, length=<value optimized out>, res=0x5d8d4) at ./src/sh_tiger1.c:300 300 x00=str[0*2]; x01=str[0*2+1]; x10=str[1*2]; x11=str[1*2+1]; (gdb) l 295 c0 = res[4]; 296 c1 = res[5]; 297 298 save_abc 299 300 x00=str[0*2]; x01=str[0*2+1]; x10=str[1*2]; x11=str[1*2+1]; 301 x20=str[2*2]; x21=str[2*2+1]; x30=str[3*2]; x31=str[3*2+1]; 302 x40=str[4*2]; x41=str[4*2+1]; x50=str[5*2]; x51=str[5*2+1]; 303 x60=str[6*2]; x61=str[6*2+1]; x70=str[7*2]; x71=str[7*2+1]; 304 Looks like the problem is that the pointer str comes from a static array of bytes (unsigned char), allocated in ./src/sh_tiger0.c line 101, but it is used as an array of 32-bit integers, leading to the alignment bug. This patch makes the SIGBUS go away on my OpenMoko: --- samhain-2.2.3.orig/src/sh_tiger0.c +++ samhain-2.2.3/src/sh_tiger0.c @@ -98,7 +98,7 @@ */ SL_TICKET tiger_fd = (-1); -static sh_byte buffer[PRIV_MAX + 72]; +static sh_byte buffer[PRIV_MAX + 72] __attribute__((aligned(32))); #if defined(TIGER_64_BIT) static Ideally the whole thing would be rewritten to be more alignment-safe, but this works until upstream can get around to doing this. -- bye, pabs http://wiki.debian.org/PaulWise
signature.asc
Description: This is a digitally signed message part

