glibc/include
Florian Weimer ea85e7d550 elf: Restore support for _r_debug interpositions and copy relocations
The changes in commit a93d9e03a3
("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>
2025-07-05 20:15:12 +02:00
..
arpa Add _FORTIFY_SOURCE support for inet_pton 2025-03-24 14:43:03 -04:00
bits Add _FORTIFY_SOURCE support for inet_ntop 2025-03-21 09:35:42 +01:00
gnu Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
net
netinet nss_files: Consolidate line parse declarations in <nss_files.h> 2020-07-21 07:33:20 +02:00
programs Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
protocols
rpc Optimize __libc_tsd_* thread variable access 2025-05-16 19:53:09 +02:00
rpcsvc Remove --enable-obsolete-nsl configure flag 2020-07-08 17:25:57 +02:00
sys Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
aio.h Linux: Move aio_suspend, aio_suspend64, __aio_suspend_time64 to libc 2021-06-25 11:55:27 +02:00
aliases.h Move 'aliases' routines from 'inet' into 'nss' 2023-10-24 12:30:59 +02:00
alloc_buffer.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
alloca.h Remove macros extend_alloca, extend_alloca_account [BZ #18023] 2018-06-27 19:20:37 +02:00
allocate_once.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
ar.h Add missing header wrappers under include/ 2019-02-16 08:25:16 +01:00
argp-fmtstream.h
argp.h ldbl-opt: Add argp_error and argp_failure (bug 23983) 2019-03-01 15:21:32 -03:00
argz.h Use libc_hidden_* for argz_next, __argz_next (bug 15105). 2018-02-15 21:00:02 +00:00
array_length.h include/array_length.h: add array_foreach[_const] macros 2025-06-17 09:57:40 -03:00
assert.h assert: Do not use stderr in libc-internal assert 2022-08-03 11:43:04 +02:00
atomic.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
atomic_wide_counter.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
byteswap.h
clone_internal.h posix: Add pidfd_spawn and pidfd_spawnp (BZ 30349) 2023-09-05 13:08:59 -03:00
complex.h
cpio.h
ctype.h Use proper extern declaration for _nl_C_LC_CTYPE_{class,toupper,tolower} 2025-05-16 19:53:09 +02:00
des.h
dirent.h Use 64 bit time_t stat internally 2021-06-22 12:09:52 -03:00
dlfcn.h elf: Do not add a copy of _dl_find_object to libc.so 2025-02-01 12:37:58 +01:00
dso_handle.h
elf.h elf: Add DL_ADDRESS_WITHOUT_RELOC [BZ #33088] 2025-07-01 03:44:52 +08:00
endian.h
envz.h
err.h ldbl-128ibm-compat: PLT redirects for using ldbl redirects internally 2020-03-25 14:34:23 -05:00
errno.h stdlib: Do not use GLIBC_PRIVATE ABI for errno in libc_nonshared.a 2024-09-06 14:07:00 +02:00
error.h Mark various cold functions as __COLD 2023-05-01 19:33:21 +02:00
execinfo.h
fcntl.h Fix Linux fcntl OFD locks for non-LFS architectures (BZ#20251) 2018-06-26 13:22:53 -03:00
features-time64.h y2038: Add support for 64-bit time on legacy ABIs 2021-06-15 10:42:11 -03:00
features.h Bump version to 2.41 2025-01-28 18:25:13 +01:00
fenv.h Move fenv.h soft-float inlines from fenv_private.h to include/fenv.h. 2018-09-04 19:52:06 +00:00
file_change_detection.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
filename.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
float.h Make totalorder and totalordermag functions take pointer arguments. 2019-08-15 15:18:34 +00:00
fmtmsg.h
fnmatch.h
fpu_control.h
fstab.h Add missing header wrappers under include/ 2019-02-16 08:25:16 +01:00
fts.h io: Add fts64 with 64-bit time_t support 2021-06-15 10:42:11 -03:00
ftw.h io: Add ftw64 with 64-bit time_t support 2021-06-15 10:42:11 -03:00
gconv.h
getopt.h
getopt_int.h
glob.h Fix extra PLT reference in libc.so due to __glob64_time64 if build with gcc 7.5 on 32bit. 2021-07-01 16:46:59 +02:00
gmp.h Apply asm redirection in gmp.h before first use 2022-11-07 10:40:21 -03:00
gnu-versions.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
grp-merge.h Remove 'grp' and merge into 'nss' and 'posix' 2023-10-24 12:30:59 +02:00
grp.h Remove 'grp' and merge into 'nss' and 'posix' 2023-10-24 12:30:59 +02:00
gshadow.h Remove 'gshadow' and merge into 'nss' 2023-10-24 12:30:59 +02:00
iconv.h
idx.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
ifaddrs.h nscd: Do not rebuild getaddrinfo (bug 30709) 2023-08-11 10:10:16 +02:00
ifreq.h
ifunc-impl-list.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
inline-hashtab.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
intprops.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
inttypes.h Make strtoimax, strtoumax, wcstoimax, wcstoumax into aliases 2020-12-08 18:15:27 +00:00
langinfo.h
lastlog.h Add missing header wrappers under include/ 2019-02-16 08:25:16 +01:00
libc-diag.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
libc-internal.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
libc-misc.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
libc-pointer-arith.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
libc-symbols.h Fix comment typo in libc-symbols.h 2025-05-27 11:34:14 +01:00
libgen.h
libintl.h Document the internal _ and N_ macros 2020-05-06 17:35:40 +02:00
limits.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
link.h elf: Restore support for _r_debug interpositions and copy relocations 2025-07-05 20:15:12 +02:00
list.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
list_t.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
locale.h
loop_unroll.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
malloc.h Simplify __malloc_initialized 2021-07-22 18:38:04 +05:30
math-narrow-eval.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
math.h math: Remove __XXX math functions from installed math.h [BZ #32418] 2024-12-12 16:17:54 +08:00
mcheck.h mcheck: Wean away from malloc hooks [BZ #23489] 2021-07-22 18:38:02 +05:30
memory.h
mntent.h
monetary.h Rename __LONG_DOUBLE_USES_FLOAT128 to __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 2020-04-30 08:52:08 -05:00
mqueue.h Linux: Move mq_send, mq_timedsend, __mq_timedsend_time64 to libc 2021-06-25 12:21:12 +02:00
netdb.h Move 'netgroup' routines from 'inet' into 'nss' 2023-10-24 12:30:59 +02:00
netgroup.h Move 'netgroup' routines from 'inet' into 'nss' 2023-10-24 12:30:59 +02:00
nl_types.h
nss.h
nss_dns.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
nss_files.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
nsswitch.h
obstack.h
plural-exp.h
poll.h
printf.h stdio-common: Convert vfprintf and related functions to buffers 2022-12-19 18:56:54 +01:00
printf_buffer.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
pthread.h Linux: Move mq_notify from librt to libc 2021-06-25 12:20:47 +02:00
pty.h login: Move libutil into libc 2021-06-30 08:43:37 +02:00
pwd.h Remove 'pwd' and merge into 'nss' 2023-10-24 12:30:59 +02:00
random-bits.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
re_comp.h Add missing header wrappers under include/ 2019-02-16 08:25:16 +01:00
regex.h Fix regex type usage 2023-05-01 09:08:59 -04:00
regexp.h Add missing header wrappers under include/ 2019-02-16 08:25:16 +01:00
register-atfork.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
resolv.h resolv: Add internal __res_binary_hnok function 2022-08-30 10:02:49 +02:00
rounding-mode.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
rtld-malloc.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
sched.h Add hidden prototypes for __sched_getparam, __sched_getscheduler 2020-02-20 08:57:01 +01:00
scratch_buffer.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
search.h misc: Add twalk_r function 2019-05-02 11:42:51 +02:00
set-freeres.h elf: Merge __dl_libc_freemem into __rtld_libc_freeres 2025-02-02 20:10:09 +01:00
setjmp.h chk: Add and fix hidden builtin definitions for *_chk 2023-08-03 22:46:48 +02:00
sgtty.h
shadow.h Remove 'shadow' and merge into 'nss' 2023-10-24 12:30:59 +02:00
shlib-compat.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
shm-directory.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
signal.h stdio: Remove the usage of $(fno-unit-at-a-time) for siglist.c 2022-05-13 10:54:41 -03:00
spawn.h posix: Use posix_spawn for wordexp 2019-10-09 17:48:41 -03:00
stab.h
stackinfo.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
stap-probe.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
stdbit.h Implement C23 <stdbit.h> 2024-01-03 12:07:14 +00:00
stdc-predef.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
stdint.h Move inttypes.h and stdint.h to stdlib. 2019-03-13 09:42:09 -04:00
stdio.h stdlib: Fix __libc_message_impl iovec size (BZ 32947) 2025-06-30 13:51:41 -03:00
stdio_ext.h
stdlib.h debug: Improve '%n' fortify detection (BZ 30932) 2025-03-21 15:46:48 -03:00
string.h include/string.h: Also redirect calls if not inlined in libpthread 2025-01-07 20:53:18 +01:00
strings.h
struct___timeb64.h time: Add 64-bit time_t support for ftime 2020-10-27 09:54:50 -03:00
struct___timespec64.h y2038: include: Move struct __timespec64 definition to a separate file 2020-04-06 23:05:11 +02:00
struct___timeval64.h y2038: include: Move struct __timeval64 definition to a separate file 2020-05-05 19:36:25 +02:00
stubs-prologue.h
syscall.h
sysexits.h
syslog.h
tar.h
termios.h termios: add new baud_t interface, defined to be explicitly numeric 2025-06-17 09:11:38 -03:00
tgmath.h Don't use glibc <tgmath.h> when testing with Clang 2024-12-21 05:24:07 +08:00
time.h Define in_int32_t_range to check if the 64 bit time_t syscall should be used 2022-11-17 14:35:13 -03:00
ttyent.h
uchar.h
ucontext.h
ulimit.h
unistd.h io: replace local_isatty() with a proper function __isatty_nostatus() 2025-06-17 09:11:38 -03:00
unistd_ext.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
utime.h
utmp.h login: Move libutil into libc 2021-06-30 08:43:37 +02:00
values.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
verify.h posix: Sync regex with gnulib 2019-11-06 09:20:52 -03:00
wait.h Add missing header wrappers under include/ 2019-02-16 08:25:16 +01:00
wchar.h Refer to C23 in place of C2X in glibc 2024-02-01 11:02:01 +00:00
wctype.h
wordexp.h