diff options
author | Florian Weimer <fweimer@redhat.com> | 2016-10-28 11:36:12 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2016-10-28 17:12:18 +0200 |
commit | 9b685f96f4a725ce996aeab7d4b7d665f1c75eeb (patch) | |
tree | 6152d8618d35b2e006d0725aec8b0dc9472939c1 /malloc/arena.c | |
parent | 09fa7525b6c4318c93b9f224fd36c84173d6fcb2 (diff) | |
download | glibc-fw/heap-protector.tar.gz |
malloc: Implement heap protectorfw/heap-protector
Diffstat (limited to 'malloc/arena.c')
-rw-r--r-- | malloc/arena.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/malloc/arena.c b/malloc/arena.c index eed42471a7..ada79f63bf 100644 --- a/malloc/arena.c +++ b/malloc/arena.c @@ -340,6 +340,19 @@ ptmalloc_init (void) if (check_action != 0) __malloc_check_init (); } + +#ifdef SHARED + /* For a shared library, elf/rtld.c performed key setup in + security_init, and we copy the keys. In static builds, the guard + cookies have already been initialized in csu/libc-start.c. */ + __malloc_header_guard = GLRO (dl_malloc_header_guard); + __malloc_footer_guard = GLRO (dl_malloc_footer_guard); +#endif + + /* Initialize the top chunk, based on the heap protector guards. */ + malloc_init_state (&main_arena); + set_head (main_arena.top, 0); + #if HAVE_MALLOC_INIT_HOOK void (*hook) (void) = atomic_forced_read (__malloc_initialize_hook); if (hook != NULL) |