From 25b3aadaf646bff18d6527e03717c87bf50b3a50 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Tue, 28 Sep 2010 15:11:48 +0200 Subject: [PATCH] Don't try to write to _rtld_global_ro after performing relro protection --- ChangeLog | 5 +++++ elf/rtld.c | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3351f492004..44886cf62f3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-09-28 Andreas Schwab + + * elf/rtld.c (dl_main): Move setting of GLRO(dl_init_all_dirs) + before performing relro protection. + 2010-09-27 Andreas Schwab * include/link.h (struct link_map): Add l_free_initfini. diff --git a/elf/rtld.c b/elf/rtld.c index 9a560b3ced6..201c9cf26ba 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -2168,6 +2168,10 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n", we need it in the memory handling later. */ GLRO(dl_initial_searchlist) = *GL(dl_ns)[LM_ID_BASE]._ns_main_searchlist; + /* Remember the last search directory added at startup, now that + malloc will no longer be the one from dl-minimal.c. */ + GLRO(dl_init_all_dirs) = GL(dl_all_dirs); + if (prelinked) { if (main_map->l_info [ADDRIDX (DT_GNU_CONFLICT)] != NULL) @@ -2288,10 +2292,6 @@ ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n", lossage); } - /* Remember the last search directory added at startup, now that - malloc will no longer be the one from dl-minimal.c. */ - GLRO(dl_init_all_dirs) = GL(dl_all_dirs); - if (! prelinked && rtld_multiple_ref) { /* There was an explicit ref to the dynamic linker as a shared lib. -- 2.47.2