summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2025-07-04 21:46:30 +0200
committerFlorian Weimer <fweimer@redhat.com>2025-07-05 20:15:12 +0200
commitea85e7d55087075376a29261e722e4fae14ecbe7 (patch)
tree9915b760ca2e81597b8fcc6583180cea91e2efbe /include
parent8329939a37f483a16013dd8af8303cbcb86d92cb (diff)
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>
Diffstat (limited to 'include')
-rw-r--r--include/link.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/link.h b/include/link.h
index 518bfd1670..41e5e54a7b 100644
--- a/include/link.h
+++ b/include/link.h
@@ -365,6 +365,8 @@ struct auditstate
dynamic linker. */
extern struct r_debug_extended _r_debug_extended attribute_hidden;
+rtld_hidden_proto (_r_debug)
+
#if __ELF_NATIVE_CLASS == 32
# define symbind symbind32
# define LA_SYMBIND "la_symbind32"