glibc/sysdeps
Michael Jeanson 2b92982e23 nptl: fix potential merge of __rseq_* relro symbols
While working on a patch to add support for the extensible rseq ABI, we
came across an issue where a new 'const' variable would be merged with
the existing '__rseq_size' variable. We tracked this to the use of
'-fmerge-all-constants' which allows the compiler to merge identical
constant variables. This means that all 'const' variables in a compile
unit that are of the same size and are initialized to the same value can
be merged.

In this specific case, on 32 bit systems 'unsigned int' and 'ptrdiff_t'
are both 4 bytes and initialized to 0 which should trigger the merge.
However for reasons we haven't delved into when the attribute 'section
(".data.rel.ro")' is added to the mix, only variables of the same exact
types are merged. As far as we know this behavior is not specified
anywhere and could change with a new compiler version, hence this patch.

Move the definitions of these variables into an assembler file and add
hidden writable aliases for internal use. This has the added bonus of
removing the asm workaround to set the values on rseq registration.

Tested on Debian 12 with GCC 12.2.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Reviewed-by: Florian Weimer <fweimer@redhat.com>
2024-07-03 21:40:30 +02:00
..
aarch64 Aarch64: Add new memset for Qualcomm's oryon-1 core 2024-06-30 13:47:17 +02:00
alpha elf: Remove HWCAP_IMPORTANT 2024-06-18 10:45:36 +02:00
arc Convert to autoconf 2.72 (vanilla release, no distribution patches) 2024-06-17 21:15:28 +02:00
arm arm: Avoid UB in elf_machine_rel() 2024-06-26 12:45:43 +02:00
csky elf: Remove HWCAP_IMPORTANT 2024-06-18 10:45:36 +02:00
generic elf: Support recursive use of dynamic TLS in interposed malloc 2024-07-01 19:02:11 +02:00
gnu login: Use unsigned 32-bit types for seconds-since-epoch 2024-04-19 14:38:17 +02:00
hppa Update hppa libm-test-ulps 2024-06-23 13:51:25 -04:00
htl htl: Implement some support for TLS_DTV_AT_TP 2024-03-23 23:00:30 +01:00
hurd hurd: Move internal functions to internal header 2024-03-23 22:43:07 +01:00
i386 i386: Update ulps 2024-06-20 19:00:48 +02:00
ieee754 Convert to autoconf 2.72 (vanilla release, no distribution patches) 2024-06-17 21:15:28 +02:00
loongarch LoongArch: Fix tst-gnu2-tls2 test case 2024-06-26 12:02:07 +08:00
m68k Implement C23 logp1 2024-06-17 13:47:09 +00:00
mach Convert to autoconf 2.72 (vanilla release, no distribution patches) 2024-06-17 21:15:28 +02:00
microblaze Implement C23 logp1 2024-06-17 13:47:09 +00:00
mips MIPSr6/math: Use builtin fma and fmaf 2024-07-01 14:52:30 -03:00
nios2 Convert to autoconf 2.72 (vanilla release, no distribution patches) 2024-06-17 21:15:28 +02:00
nptl nptl: fix potential merge of __rseq_* relro symbols 2024-07-03 21:40:30 +02:00
or1k Implement C23 logp1 2024-06-17 13:47:09 +00:00
posix posix: Sync tempname with gnulib 2024-04-10 14:53:39 -03:00
powerpc powerpc: Update ulps 2024-06-20 12:15:31 +02:00
pthread Add crt1-2.0.o for glibc 2.0 compatibility tests 2024-05-06 07:49:40 -07:00
riscv riscv: Update nofpu libm test ulps 2024-07-03 21:05:34 +02:00
s390 s390x: Capture grep output in static PIE check 2024-06-20 14:34:06 +02:00
sh Implement C23 logp1 2024-06-17 13:47:09 +00:00
sparc sparc: Regenerate ULPs 2024-06-19 14:58:32 +02:00
unix hppa/vdso: Provide 64-bit clock_gettime() vDSO only 2024-07-02 16:26:32 -04:00
wordsize-32 Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
wordsize-64 Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
x86 x86: Set default non_temporal_threshold for Zhaoxin processors 2024-06-30 06:26:43 -07:00
x86_64 elf: Support recursive use of dynamic TLS in interposed malloc 2024-07-01 19:02:11 +02:00