about summary refs log tree commit diff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2021-08-02 13:52:36 -0700
committerH.J. Lu <hjl.tools@gmail.com>2021-10-06 09:02:21 -0700
commit3234a31b489707f19ec6d4c9909af06f20ddb901 (patch)
tree86b3e527cabd50fcf24644b07b225ea7d9b2d796
parent47252e4336d6d46e33fe8abe0c5b1d0f48c1db48 (diff)
downloadglibc-3234a31b489707f19ec6d4c9909af06f20ddb901.tar.gz
glibc-3234a31b489707f19ec6d4c9909af06f20ddb901.tar.xz
glibc-3234a31b489707f19ec6d4c9909af06f20ddb901.zip
ld.so: Don't fill the DT_DEBUG entry in ld.so [BZ #28129]
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.
-rw-r--r--elf/rtld.c6
1 files changed, 0 insertions, 6 deletions
diff --git a/elf/rtld.c b/elf/rtld.c
index 9642eb9c92..628245d8cd 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -1761,17 +1761,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.  */