public inbox for
 help / color / mirror / Atom feed
From: "H.J. Lu" <>
	Florian Weimer <>,
	Daniel Walker <>
Subject: [PATCH v8 0/1] Extend struct r_debug to support multiple namespaces
Date: Wed,  8 Sep 2021 11:25:58 -0700	[thread overview]
Message-ID: <> (raw)

Changes in the v8 patch:

1. Check base.r_brk == 0, instead of r_next == NULL, to decide if a
namespace has been initialized.  r_next can be NULL after initialization,
but base.r_brk must be non-zero after initialization.

Changes in the v7 patch:

1. Rewrite dl-debug-symbols.S and remove dl-debug-compat-symbols.c.
2. Bump r_version to 2 only when multiple namespaces are used.
3. Verify r_version == 1 without multiple namespaces.
4. Keep the empty (unused) namespace on the namespace linked list.
5. Use atomic_store_release to update r_version and r_next.
6. Add _dl_debug_update without adding the namespace to the namespace
linked list.

Changes in the v6 patch:

1. Add comments for dl-debug-compat-symbols.[o|os] usage. 

Changes in the v5 patch:

1. Use struct r_debug as the base for struct r_debug_extended.
2. Keep _dl_debug_initialize return type.

Changes in the v4 patch:

1. Improve the empty namespace removal from the namespace linked list.
2. Check r_version == 0 for the unused namespace.

Changes in the v3 patch:

1. Remove the empty namespace from the namespace linked list.
2. Properly add the new namespace to the linked list.

Changes in the v2 patch:

1. Bump r_version to 2.
2. Don't add DT_DEBUGSZ.
3. Add struct r_debug_extended to extend struct r_debug.
4. Don't update the r_state field in the copy of _r_debug in executable
since it is not consumed by the program.

Glibc does not provide an interface for debugger to access libraries
loaded in multiple namespaces via dlmopen.

The current rtld-debugger interface is described in the file:


under the "Standard debugger interface" heading.  This interface only
provides access to the first link-map (LM_ID_BASE).

1. Bump r_version to 2 when multiple namespaces are used.  This triggers
the GDB bug:

2. Add struct r_debug_extended to extend struct r_debug into a linked-list,
where each element correlates to an unique namespace.
3. Initialize the r_debug_extended structure.  Bump r_version to 2 for
the new namespace and add the new namespace to the namespace linked list.
4. Add _dl_debug_update to return the address of struct r_debug' of a
5. Add a hidden symbol, _r_debug_extended, for struct r_debug_extended.
6. Provide the compatibility symbol, _r_debug, with size of struct r_debug,
as an alise of _r_debug_extended, for programs which reference _r_debug.

This fixes BZ #15971.

H.J. Lu (1):
  Extend struct r_debug to support multiple namespaces [BZ #15971]

 NEWS                            | 11 ++++-
 csu/Makefile                    |  3 ++
 csu/rtld-sizes.sym              |  6 +++
 elf/Makefile                    |  7 +++-
 elf/dl-close.c                  |  2 +-
 elf/dl-debug-symbols.S          | 37 +++++++++++++++++
 elf/dl-debug.c                  | 72 ++++++++++++++++++++++++---------
 elf/dl-load.c                   |  2 +-
 elf/dl-open.c                   | 10 ++---
 elf/dl-reloc-static-pie.c       |  2 +-
 elf/link.h                      | 36 ++++++++++++-----
 elf/rtld-debugger-interface.txt | 14 +++++++
 elf/rtld.c                      |  4 +-
 elf/tst-dlmopen4.c              | 68 +++++++++++++++++++++++++++++++
 elf/tst-dlopen-nodelete-reloc.c |  2 +
 include/link.h                  |  4 ++
 sysdeps/generic/ldsodefs.h      | 12 ++++--
 17 files changed, 247 insertions(+), 45 deletions(-)
 create mode 100644 csu/rtld-sizes.sym
 create mode 100644 elf/dl-debug-symbols.S
 create mode 100644 elf/tst-dlmopen4.c


             reply	other threads:[~2021-09-08 18:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-08 18:25 H.J. Lu [this message]
2021-09-08 18:25 ` [PATCH v8 1/1] Extend struct r_debug to support multiple namespaces [BZ #15971] H.J. Lu
2021-09-10 18:59   ` Florian Weimer
2021-09-10 19:26     ` H.J. Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).