public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug dynamic-link/28130] New: DT_DEBUG doesn't work with COPY relocation
@ 2021-07-24 18:29 hjl.tools at gmail dot com
  2021-07-24 19:00 ` [Bug dynamic-link/28130] " hjl.tools at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: hjl.tools at gmail dot com @ 2021-07-24 18:29 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28130

            Bug ID: 28130
           Summary: DT_DEBUG doesn't work with COPY relocation
           Product: glibc
           Version: 2.34
            Status: NEW
          Severity: normal
          Priority: P2
         Component: dynamic-link
          Assignee: unassigned at sourceware dot org
          Reporter: hjl.tools at gmail dot com
  Target Milestone: ---

rtld.c has

  /* Initialize _r_debug.  */
  struct r_debug *r = _dl_debug_initialize (GL(dl_rtld_map).l_addr,
                                            LM_ID_BASE);

  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;

With COPY relocation, the real address of _r_debug may be in the executable
if it references _r_debug.  If debugger uses DT_DEBUG, it will reference the
staled original definition of _r_debug in ld.so.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug dynamic-link/28130] DT_DEBUG doesn't work with COPY relocation
  2021-07-24 18:29 [Bug dynamic-link/28130] New: DT_DEBUG doesn't work with COPY relocation hjl.tools at gmail dot com
@ 2021-07-24 19:00 ` hjl.tools at gmail dot com
  2021-07-24 20:28 ` schwab@linux-m68k.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: hjl.tools at gmail dot com @ 2021-07-24 19:00 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28130

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
We can hide _r_debug and add

extern struct r_debug * __r_debug_location (void) __attribute_const__;
#define _r_debug (*__r_debug_location (())

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug dynamic-link/28130] DT_DEBUG doesn't work with COPY relocation
  2021-07-24 18:29 [Bug dynamic-link/28130] New: DT_DEBUG doesn't work with COPY relocation hjl.tools at gmail dot com
  2021-07-24 19:00 ` [Bug dynamic-link/28130] " hjl.tools at gmail dot com
@ 2021-07-24 20:28 ` schwab@linux-m68k.org
  2021-07-24 20:45 ` hjl.tools at gmail dot com
  2021-07-24 21:01 ` schwab@linux-m68k.org
  3 siblings, 0 replies; 5+ messages in thread
From: schwab@linux-m68k.org @ 2021-07-24 20:28 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28130

--- Comment #2 from Andreas Schwab <schwab@linux-m68k.org> ---
Nothing should be using _r_debug.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug dynamic-link/28130] DT_DEBUG doesn't work with COPY relocation
  2021-07-24 18:29 [Bug dynamic-link/28130] New: DT_DEBUG doesn't work with COPY relocation hjl.tools at gmail dot com
  2021-07-24 19:00 ` [Bug dynamic-link/28130] " hjl.tools at gmail dot com
  2021-07-24 20:28 ` schwab@linux-m68k.org
@ 2021-07-24 20:45 ` hjl.tools at gmail dot com
  2021-07-24 21:01 ` schwab@linux-m68k.org
  3 siblings, 0 replies; 5+ messages in thread
From: hjl.tools at gmail dot com @ 2021-07-24 20:45 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28130

--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Andreas Schwab from comment #2)
> Nothing should be using _r_debug.

_r_debug is exported and used by glibc tests.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug dynamic-link/28130] DT_DEBUG doesn't work with COPY relocation
  2021-07-24 18:29 [Bug dynamic-link/28130] New: DT_DEBUG doesn't work with COPY relocation hjl.tools at gmail dot com
                   ` (2 preceding siblings ...)
  2021-07-24 20:45 ` hjl.tools at gmail dot com
@ 2021-07-24 21:01 ` schwab@linux-m68k.org
  3 siblings, 0 replies; 5+ messages in thread
From: schwab@linux-m68k.org @ 2021-07-24 21:01 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=28130

--- Comment #4 from Andreas Schwab <schwab@linux-m68k.org> ---
That doesn't matter.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-07-24 21:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-24 18:29 [Bug dynamic-link/28130] New: DT_DEBUG doesn't work with COPY relocation hjl.tools at gmail dot com
2021-07-24 19:00 ` [Bug dynamic-link/28130] " hjl.tools at gmail dot com
2021-07-24 20:28 ` schwab@linux-m68k.org
2021-07-24 20:45 ` hjl.tools at gmail dot com
2021-07-24 21:01 ` schwab@linux-m68k.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).