From: "H.J. Lu" <hjl.tools@gmail.com>
To: libc-alpha@sourceware.org
Cc: gdb@sourceware.org, Daniel Walker <danielwa@cisco.com>
Subject: [PATCH v4 0/2] Extend struct r_debug to support multiple namespaces
Date: Wed, 18 Aug 2021 13:00:22 -0700 [thread overview]
Message-ID: <20210818200024.3240116-1-hjl.tools@gmail.com> (raw)
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:
elf/rtld-debugger-interface.txt
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. This triggers the GDB bug:
https://sourceware.org/bugzilla/show_bug.cgi?id=28236
2. Add struct r_debug_extended to extend struct r_debug into a linked-list,
where each element correlates to an unique namespace.
3. Remove the empty namespace from the namespace linked list and clear
its r_version field.
4. Add the new namespace, whose r_version field is 0, to the namespace
linked list.
5. Initialize the r_debug_extended structure only if its r_version field
is 0 and update its r_map field if it is NULL.
6. Add a hidden symbol, _r_debug_extended, for struct r_debug_extended.
7. 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.
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:
elf/rtld-debugger-interface.txt
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. This triggers the GDB bug:
https://sourceware.org/bugzilla/show_bug.cgi?id=28236
2. Add struct r_debug_extended to extend struct r_debug into a linked-list,
where each element correlates to an unique namespace.
3. Remove the empty namespace from the namespace linked list and clear
its r_version field.
4. Add the new namespace, whose r_version field is 0, to the namespace
linked list.
5. Initialize the r_debug_extended structure only if its r_version field
is 0 and update its r_map field if it is NULL.
6. Add a hidden symbol, _r_debug_extended, for struct r_debug_extended.
7. 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.
H.J. Lu (2):
Add declare_object_symbol_alias for assembly codes [BZ #28128]
Extend struct r_debug to support multiple namespaces
NEWS | 9 ++++-
csu/Makefile | 3 ++
csu/rtld-sizes.sym | 4 ++
elf/Makefile | 22 ++++++++++-
elf/dl-close.c | 23 ++++++++++-
elf/dl-debug-symbols-gen.c | 24 ++++++++++++
elf/dl-debug-symbols.S | 31 +++++++++++++++
elf/dl-debug.c | 44 ++++++++++++---------
elf/dl-load.c | 2 +-
elf/dl-open.c | 2 +-
elf/dl-reloc-static-pie.c | 4 +-
elf/link.h | 69 +++++++++++++++++++++++++--------
elf/rtld-debugger-interface.txt | 14 +++++++
elf/rtld.c | 6 +--
elf/tst-dlmopen4.c | 68 ++++++++++++++++++++++++++++++++
include/libc-symbols.h | 12 +++---
include/link.h | 4 ++
sysdeps/generic/ldsodefs.h | 5 ++-
18 files changed, 291 insertions(+), 55 deletions(-)
create mode 100644 csu/rtld-sizes.sym
create mode 100644 elf/dl-debug-symbols-gen.c
create mode 100644 elf/dl-debug-symbols.S
create mode 100644 elf/tst-dlmopen4.c
--
2.31.1
next reply other threads:[~2021-08-18 20:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-18 20:00 H.J. Lu [this message]
2021-08-18 20:00 ` [PATCH v4 1/2] Add declare_object_symbol_alias for assembly codes [BZ #28128] H.J. Lu
2021-08-18 20:00 ` [PATCH v4 2/2] Extend struct r_debug to support multiple namespaces 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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210818200024.3240116-1-hjl.tools@gmail.com \
--to=hjl.tools@gmail.com \
--cc=danielwa@cisco.com \
--cc=gdb@sourceware.org \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* 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).