diff mbox series

ld.so: Don't fill the DT_DEBUG entry in ld.so [BZ #28129]

Message ID 20210802205236.322869-1-hjl.tools@gmail.com
State New
Headers show
Series ld.so: Don't fill the DT_DEBUG entry in ld.so [BZ #28129] | expand

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent
dj/TryBot-32bit success Build for i686

Commit Message

H.J. Lu Aug. 2, 2021, 8:52 p.m. UTC
Linker creates the DT_DEBUG entry only in executables.  Don't fill the
non-existent DT_DEBUG entry in ld.so with the run-time address of the
r_debug structure.  This fixes BZ #28129.
---
 elf/rtld.c | 6 ------
 1 file changed, 6 deletions(-)
diff mbox series

Patch

diff --git a/elf/rtld.c b/elf/rtld.c
index d733359eaf..929bd41c07 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -1763,17 +1763,11 @@  dl_main (const ElfW(Phdr) *phdr,
 #ifdef ELF_MACHINE_DEBUG_SETUP
   /* Some machines (e.g. MIPS) don't use DT_DEBUG in this way.  */
   ELF_MACHINE_DEBUG_SETUP (main_map, r);
-  ELF_MACHINE_DEBUG_SETUP (&GL(dl_rtld_map), r);
 #else
   if (main_map->l_info[DT_DEBUG] != NULL)
     /* There is a DT_DEBUG entry in the dynamic section.  Fill it in
        with the run-time address of the r_debug structure  */
     main_map->l_info[DT_DEBUG]->d_un.d_ptr = (ElfW(Addr)) r;
-
-  /* Fill in the pointer in the dynamic linker's own dynamic section, in
-     case you run gdb on the dynamic linker directly.  */
-  if (GL(dl_rtld_map).l_info[DT_DEBUG] != NULL)
-    GL(dl_rtld_map).l_info[DT_DEBUG]->d_un.d_ptr = (ElfW(Addr)) r;
 #endif
 
   /* We start adding objects.  */