public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] ld.so: Don't fill the DT_DEBUG entry in ld.so [BZ #28129]
@ 2021-08-02 20:52 H.J. Lu
  2021-10-06 15:14 ` H.J. Lu
  0 siblings, 1 reply; 2+ messages in thread
From: H.J. Lu @ 2021-08-02 20:52 UTC (permalink / raw)
  To: libc-alpha

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 --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.  */
-- 
2.31.1


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

* Re: [PATCH] ld.so: Don't fill the DT_DEBUG entry in ld.so [BZ #28129]
  2021-08-02 20:52 [PATCH] ld.so: Don't fill the DT_DEBUG entry in ld.so [BZ #28129] H.J. Lu
@ 2021-10-06 15:14 ` H.J. Lu
  0 siblings, 0 replies; 2+ messages in thread
From: H.J. Lu @ 2021-10-06 15:14 UTC (permalink / raw)
  To: GNU C Library

On Mon, Aug 2, 2021 at 1:52 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> 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 --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.  */
> --
> 2.31.1
>

I will check in this patch if there are no comments.

-- 
H.J.

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

end of thread, other threads:[~2021-10-06 15:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-02 20:52 [PATCH] ld.so: Don't fill the DT_DEBUG entry in ld.so [BZ #28129] H.J. Lu
2021-10-06 15:14 ` H.J. Lu

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).