mbox series

[v2,0/2] Extend struct r_debug to support multiple namespaces

Message ID 20210817010629.593479-1-hjl.tools@gmail.com
Headers show
Series Extend struct r_debug to support multiple namespaces | expand

Message

H.J. Lu Aug. 17, 2021, 1:06 a.m. UTC
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).

Based on the patch from Conan C Huang <conhuang@cisco.com>:

https://sourceware.org/pipermail/libc-alpha/2020-June/115448.html

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. Add a hidden symbol, _r_debug_extended, for struct r_debug_extended.
4. 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

 csu/Makefile                    |  3 ++
 csu/rtld-sizes.sym              |  4 ++
 elf/Makefile                    | 22 ++++++++++-
 elf/dl-close.c                  |  2 +-
 elf/dl-debug-symbols-gen.c      | 24 +++++++++++
 elf/dl-debug-symbols.S          | 31 +++++++++++++++
 elf/dl-debug.c                  | 29 +++++++-------
 elf/dl-load.c                   |  2 +-
 elf/dl-open.c                   |  2 +-
 elf/dl-reloc-static-pie.c       |  2 +-
 elf/link.h                      | 70 +++++++++++++++++++++++++--------
 elf/rtld-debugger-interface.txt | 14 +++++++
 elf/rtld.c                      |  4 +-
 elf/tst-dlmopen4.c              | 68 ++++++++++++++++++++++++++++++++
 include/libc-symbols.h          | 12 +++---
 include/link.h                  |  4 ++
 sysdeps/generic/ldsodefs.h      |  5 ++-
 17 files changed, 252 insertions(+), 46 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

Comments

Joseph Myers Aug. 17, 2021, 5:57 p.m. UTC | #1
On Mon, 16 Aug 2021, H.J. Lu via Gdb wrote:

> 1. Bump r_version to 2.  This triggers the GDB bug:
> 
> https://sourceware.org/bugzilla/show_bug.cgi?id=28236

This seems like it needs a NEWS entry under "Deprecated and removed 
features, and other changes affecting compatibility" if it results in a 
user-visible problem using older GDB with newer glibc (that bug report 
doesn't say what the actual user-visible symptoms are, if any).  (The new 
feature should probably have a NEWS entry under "Major new features" in 
any case.)