On Wed, Jan 27, 2016 at 5:23 PM, Ben Hutchings <b...@decadent.org.uk> wrote: > Control: tag -1 moreinfo > > On Wed, 2016-01-27 at 23:54 +0100, Marco d'Itri wrote: >> Control: reassign -1 src:linux >> Control: found -1 4.3.0-1 >> Control: retitle -1 getauxval(AT_RANDOM) broken on sparc64 >> >> On Jan 27, Anatoly Pugachev <mator...@gmail.com> wrote: >> >> > Program terminated with signal SIGUSR1, User defined signal 1. >> > #0 0x000001000001b9b8 in initialize_srand () at src/basic/random- >> > util.c:107 >> > 107 x ^= *(unsigned*) auxv; >> > (gdb) bt >> Looks like getauxval(AT_RANDOM) returns garbage on sparc64: >> >> x = 0; >> auxv = (void*) getauxval(AT_RANDOM); >> if (auxv) >> x ^= *(unsigned*) auxv; > > There is no documented alignment guarantee for the AT_RANDOM bytes so I > think this caller is wrong to treat it as an array of unsigned int.
Also, you can verify that from a debugger without changing the code, by printing the value of the pointer `auxv` and check if either of the lower two bits are set. > What happens if you change it to: > > if (auxv) > memcpy(&x, auxv, sizeof(x)); > > ? > > Ben. > > -- > Ben Hutchings > 73.46% of all statistics are made up.