Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-101985

glibc: _r_debug extension for multiple namespaces: copy relocation support [rhel-10]

Linking RHIVOS CVEs to...Migration: Automation ...SWIFT: Generate New Ti...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • glibc-2.39-57.el10
    • None
    • Hide
      7278d11f3a0cd528188c719bab75575b0aea2c6e
      8329939a37f483a16013dd8af8303cbcb86d92cb
      ea85e7d55087075376a29261e722e4fae14ecbe7
      620f0730f311635cd0e175a3ae4d0fc700c76366
      Show
      7278d11f3a0cd528188c719bab75575b0aea2c6e 8329939a37f483a16013dd8af8303cbcb86d92cb ea85e7d55087075376a29261e722e4fae14ecbe7 620f0730f311635cd0e175a3ae4d0fc700c76366
    • 1
    • rhel-pt-c-libs
    • 2
    • False
    • False
    • Hide

      None

      Show
      None
    • No
    • Red Hat Enterprise Linux
    • PT C Libraries 2025 S12
    • All
    • None

      Backport _r_debug version 2 to help with debugging processes using multiple namespaces. Both handling coredumps and attaching with gdb -p should work with these changes.

      The two main commits are:

      commit ea85e7d55087075376a29261e722e4fae14ecbe7
      Author: Florian Weimer <fweimer@redhat.com>
      Date:   Fri Jul 4 21:46:30 2025 +0200
      
          elf: Restore support for _r_debug interpositions and copy relocations
          
          The changes in commit a93d9e03a31ec14405cb3a09aa95413b67067380
          ("Extend struct r_debug to support multiple namespaces [BZ #15971]")
          break the dyninst dynamic instrumentation tool.  It brings its
          own definition of _r_debug (rather than a declaration).
          
          Furthermore, it turns out it is rather hard to use the proposed
          handshake for accessing _r_debug via DT_DEBUG. If applications want
          to access _r_debug, they can do so directly if the relevant code has
          been built as PIC.  To protect against harm from accidental copy
          relocations due to linker relaxations, this commit restores copy
          relocation support by adjusting both copies if interposition or
          copy relocations are in play.  Therefore, it is possible to
          use a hidden reference in ld.so to access _r_debug.
          
          Only perform the copy relocation initialization if libc has been
          loaded.  Otherwise, the ld.so search scope can be empty, and the
          lookup of the _r_debug symbol mail fail.
          
          Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
      
      commit a93d9e03a31ec14405cb3a09aa95413b67067380
      Author: H.J. Lu <hjl.tools@gmail.com>
      Date:   Tue Aug 17 19:35:48 2021 -0700
      
          Extend struct r_debug to support multiple namespaces [BZ #15971]
          
          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 when multiple namespaces are used.  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. 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
          namespace.
          5. Add a hidden symbol, _r_debug_extended, for struct r_debug_extended.
          6. Provide the symbol, _r_debug, with size of struct r_debug, as an alias
          of _r_debug_extended, for programs which reference _r_debug.
          
          This fixes BZ #15971.
          
          Reviewed-by: Florian Weimer <fweimer@redhat.com>
      

              xmcoufal Martin Coufal
              fweimer@redhat.com Florian Weimer
              Platform Tools - Libraries Bot Platform Tools - Libraries Bot
              Martin Coufal Martin Coufal
              Malhar Jivrajani Malhar Jivrajani
              Votes:
              0 Vote for this issue
              Watchers:
              11 Start watching this issue

                Created:
                Updated: