Fix another instance of the _dl_random masking bug, plus coding style.

* sysdeps/generic/dl-osinfo.h (_dl_setup_stack_chk_guard): Fix
	masking out of the most significant byte of random value used.
	* sysdeps/unix/sysv/linux/dl-osinfo.h (_dl_setup_stack_chk_guard):
	Fix coding style in previous change.
This commit is contained in:
David S. Miller 2012-03-12 15:57:17 -07:00
parent b4b2eb5eae
commit 98bb2f1cd2
3 changed files with 9 additions and 4 deletions

View File

@ -1,5 +1,10 @@
2012-03-12 David S. Miller <davem@davemloft.net>
* sysdeps/generic/dl-osinfo.h (_dl_setup_stack_chk_guard): Fix
masking out of the most significant byte of random value used.
* sysdeps/unix/sysv/linux/dl-osinfo.h (_dl_setup_stack_chk_guard):
Fix coding style in previous change.
* sysdeps/unix/sysv/linux/kernel-features.h
(__ASSUME_CLONE_THREAD_FLAGS): Set on sparc when 2.5.64 and later.
(__ASSUME_TGKILL): Set on sparc when 2.6.1 and later, simplify

View File

@ -37,9 +37,9 @@ _dl_setup_stack_chk_guard (void *dl_random)
{
memcpy (ret.bytes, dl_random, sizeof (ret));
#if BYTE_ORDER == LITTLE_ENDIAN
ret.num &= ~0xff;
ret.num &= ~(uintptr_t) 0xff;
#elif BYTE_ORDER == BIG_ENDIAN
ret.num &= ~(0xff << (8 * (sizeof (ret) - 1)));
ret.num &= ~((uintptr_t) 0xff << (8 * (sizeof (ret) - 1)));
#else
# error "BYTE_ORDER unknown"
#endif

View File

@ -95,9 +95,9 @@ _dl_setup_stack_chk_guard (void *dl_random)
directly and not use the kernel-provided data to seed a PRNG. */
memcpy (ret.bytes, dl_random, sizeof (ret));
#if BYTE_ORDER == LITTLE_ENDIAN
ret.num &= ~(uintptr_t)0xff;
ret.num &= ~(uintptr_t) 0xff;
#elif BYTE_ORDER == BIG_ENDIAN
ret.num &= ~((uintptr_t)0xff << (8 * (sizeof (ret) - 1)));
ret.num &= ~((uintptr_t) 0xff << (8 * (sizeof (ret) - 1)));
#else
# error "BYTE_ORDER unknown"
#endif