On Thu, Jan 28, 2016 at 3:31 AM, Patrick Baggett <
baggett.patrick@gmail.com> wrote:
>
> On Wed, Jan 27, 2016 at 5:23 PM, Ben Hutchings <
ben@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 <
matorola@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));
> >
restored original cdrom_id.c (with initialize_srand() function call) and recompiled with memcpy() and run:
mator@deb4g:~/systemd$ sudo ./cdrom_id -l /dev/vdiskb
ID_CDROM=1
there's no SIGBUS. And I don't know what it should output. Probably fixed.
Thanks.