[CMake] SEGV and signal BUS with cmake-2.8.11 on Solaris 10

Paweł Sikora pluto at agmk.net
Wed May 22 15:32:45 EDT 2013


On Sunday 19 of May 2013 20:34:28 Paul Lanken wrote:

> t at 1 (l at 1) program terminated by signal BUS (invalid address alignment)
> Current function is cmSHA512_Internal_Transform
>  1340                   T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] +
> (W512[j] = *data++);
> (dbx)
> where
> current thread: t at 1
> =>[1] cmSHA512_Internal_Transform(context = 0x100bedee0, data =
> 0xffffffff7fffb70c), line 1340 in "cm_sha2.c"
>   [2] cmSHA512_Update(context = 0x100bedee0, data = 0xffffffff7fffb70c
> "\x89PNG^M\n^Z\n", len = 358U), line 1428 in "cm_sha2.c"

this is a classic sigbus bug - a x86 programmers nightmare on sparc/arm/alpha :-)
SHA512_Internal_Transform expects sha_word64* buffer (8-byte aligned) and gcc emits
a LDX opcode on *data accessing... but passed data pointer isn't 8-byte aligned :0x...c

moreover, the cm_sha2.c sources contains strict-aliasing-violationa and gcc may emit
unexpected code for lines like this:

cm_sha2.c:      *(sha_word64*)&context->s512.buffer[112] = context->s512.bitcount[1];
cm_sha2.c:      *(sha_word64*)&context->s512.buffer[120] = context->s512.bitcount[0];


-- 
A: Because it breaks the logical sequence of discussion
Q: Why is top posting bad?


More information about the CMake mailing list