Bug 28129 - Unnecessary check DT_DEBUG in ld.so
Summary: Unnecessary check DT_DEBUG in ld.so
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: dynamic-link (show other bugs)
Version: 2.34
: P2 normal
Target Milestone: 2.35
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-07-24 14:24 UTC by H.J. Lu
Modified: 2021-10-06 16:44 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2021-07-24 14:24:24 UTC
rtld.c has

 /* 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;

But linker never generates DT_DEBUG in shared libraries.  It should be removed
or linker should add a new option to generate DT_DEBUG in shared libraries.
Comment 1 Sourceware Commits 2021-10-06 16:44:23 UTC
The master branch has been updated by H.J. Lu <hjl@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=3234a31b489707f19ec6d4c9909af06f20ddb901

commit 3234a31b489707f19ec6d4c9909af06f20ddb901
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Aug 2 13:52:36 2021 -0700

    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.
Comment 2 H.J. Lu 2021-10-06 16:44:55 UTC
Fixed for 2.35.