diff options
author | Ulrich Drepper <drepper@redhat.com> | 2009-01-11 04:44:06 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2009-01-11 04:44:06 +0000 |
commit | 965cb60a21674edb8e20b1a2a41297bcd4622361 (patch) | |
tree | 09300bc9d55e29ad73d7dde4ad75bb96cc51c103 /elf/rtld.c | |
parent | 5b656a0d301740e1be7062f950d0a4f00c471434 (diff) | |
download | glibc-965cb60a21674edb8e20b1a2a41297bcd4622361.tar.gz |
* 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.
Diffstat (limited to 'elf/rtld.c')
-rw-r--r-- | elf/rtld.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/elf/rtld.c b/elf/rtld.c index 46bece7fa3..aa4c030f73 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -1,5 +1,5 @@ /* Run time dynamic linker. - Copyright (C) 1995-2006, 2007, 2008 Free Software Foundation, Inc. + Copyright (C) 1995-2006, 2007, 2008, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -841,7 +841,7 @@ static void security_init (void) { /* Set up the stack checker's canary. */ - uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard (); + uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard (_dl_random); #ifdef THREAD_SET_STACK_GUARD THREAD_SET_STACK_GUARD (stack_chk_guard); #else @@ -851,18 +851,18 @@ security_init (void) /* Set up the pointer guard as well, if necessary. */ if (GLRO(dl_pointer_guard)) { - // XXX If it is cheap, we should use a separate value. - uintptr_t pointer_chk_guard = stack_chk_guard; -#ifndef HP_TIMING_NONAVAIL - hp_timing_t now; - HP_TIMING_NOW (now); - pointer_chk_guard ^= now; -#endif + uintptr_t pointer_chk_guard = _dl_setup_pointer_guard (_dl_random, + stack_chk_guard); #ifdef THREAD_SET_POINTER_GUARD THREAD_SET_POINTER_GUARD (pointer_chk_guard); #endif __pointer_chk_guard_local = pointer_chk_guard; } + + /* We do not need the _dl_random value anymore. The less + information we leave behind, the better, so clear the + variable. */ + _dl_random = NULL; } |