-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* sysdeps/generic/dl-osinfo.h (_dl_setup_stack_chk_guard): Take
one parameter. If non-NULL use it to initialize return value. (_dl_setup_pointer_guard): New function. * sysdeps/unix/sysv/linux/dl-osinfo.h: Likewise. * sysdeps/generic/ldsodefs.h: Declare _dl_random. * elf/rtld.c (security_init): Pass _dl_random to _dl_setup_stack_chk_guard. Call _dl_setup_pointer_guard to initialize pointer_chk_guard. * elf/dl-sysdep.c (_dl_random): New variable. (_dl_sysdep_start): Handle AT_RANDOM. (_dl_show_auxv): Likewise. * elf/dl-support.c (_dl_random): New variable. (_dl_aux_init): Handle AT_RANDOM. * csu/libc-start.c [!SHARED] (libc_start_main): Pass _dl_random to _dl_setup_stack_chk_guard. * elf/elf.h (AT_RANDOM): Define AT_BASE_PLATFORM and AT_RANDOM.
- Loading branch information
Ulrich Drepper
committed
Jan 11, 2009
1 parent
5b656a0
commit 965cb60
Showing
7 changed files
with
112 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,29 @@ | ||
#include <stdint.h> | ||
|
||
static inline uintptr_t __attribute__ ((always_inline)) | ||
_dl_setup_stack_chk_guard (void) | ||
_dl_setup_stack_chk_guard (void *dl_random) | ||
{ | ||
uintptr_t ret = 0; | ||
unsigned char *p = (unsigned char *) &ret; | ||
p[sizeof (ret) - 1] = 255; | ||
p[sizeof (ret) - 2] = '\n'; | ||
p[0] = 0; | ||
uintptr_t ret; | ||
if (dl_random == NULL) | ||
{ | ||
ret = 0; | ||
unsigned char *p = (unsigned char *) &ret; | ||
p[sizeof (ret) - 1] = 255; | ||
p[sizeof (ret) - 2] = '\n'; | ||
p[0] = 0; | ||
} | ||
else | ||
memcmp (&ret, dl_random, sizeof (ret)); | ||
return ret; | ||
} | ||
|
||
static inline uintptr_t __attribute__ ((always_inline)) | ||
_dl_setup_pointer_guard (void *dl_random, uintptr_t stack_chk_guard) | ||
{ | ||
uintptr_t ret; | ||
if (dl_random == NULL) | ||
ret = stack_chk_guard; | ||
else | ||
memcmp (&ret, (char *) dl_random + sizeof (ret), sizeof (ret)); | ||
return ret; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters