glibc/sysdeps
Michael Jeanson 7bfc35959d 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>
(cherry picked from commit 2b92982e23)
2024-07-16 16:36:42 +02:00
..
aarch64 AArch64: Check kernel version for SVE ifuncs 2024-04-10 14:03:08 +01:00
alpha configure: Use autoconf 2.71 2023-07-17 10:08:10 -04:00
arc login: Check default sizes of structs utmp, utmpx, lastlog 2024-04-19 18:38:23 +02:00
arm login: structs utmp, utmpx, lastlog _TIME_BITS independence (bug 30701) 2024-04-19 18:38:24 +02:00
csky login: structs utmp, utmpx, lastlog _TIME_BITS independence (bug 30701) 2024-04-19 18:38:24 +02:00
generic login: Check default sizes of structs utmp, utmpx, lastlog 2024-04-19 18:38:23 +02:00
gnu configure: Use autoconf 2.71 2023-07-17 10:08:10 -04:00
hppa login: Check default sizes of structs utmp, utmpx, lastlog 2024-04-19 18:38:23 +02:00
htl Fix misspellings in sysdeps/ -- BZ 25337 2023-05-30 23:02:29 +00:00
hurd hurd: Fix using interposable hurd_thread_self 2023-05-19 20:45:51 +02:00
i386 i386: ulp update for SSE2 --disable-multi-arch configurations 2024-04-25 13:07:19 +02:00
ia64 configure: Use autoconf 2.71 2023-07-17 10:08:10 -04:00
ieee754 configure: Use autoconf 2.71 2023-07-17 10:08:10 -04:00
loongarch LoongArch: Correct {__ieee754, _}_scalb -> {__ieee754, _}_scalbf 2024-03-22 09:25:39 +08:00
m68k login: structs utmp, utmpx, lastlog _TIME_BITS independence (bug 30701) 2024-04-19 18:38:24 +02:00
mach malloc: Use __get_nprocs on arena_get2 (BZ 30945) 2024-02-12 09:53:27 -03:00
microblaze login: structs utmp, utmpx, lastlog _TIME_BITS independence (bug 30701) 2024-04-19 18:38:24 +02:00
mips login: structs utmp, utmpx, lastlog _TIME_BITS independence (bug 30701) 2024-04-19 18:38:24 +02:00
nios2 login: structs utmp, utmpx, lastlog _TIME_BITS independence (bug 30701) 2024-04-19 18:38:24 +02:00
nptl nptl: fix potential merge of __rseq_* relro symbols 2024-07-16 16:36:42 +02:00
or1k login: Check default sizes of structs utmp, utmpx, lastlog 2024-04-19 18:38:23 +02:00
posix getaddrinfo: translate ENOMEM to EAI_MEMORY (bug 31163) 2024-01-02 14:37:02 +01:00
powerpc login: structs utmp, utmpx, lastlog _TIME_BITS independence (bug 30701) 2024-04-19 18:38:24 +02:00
pthread nptl: Fix tst-cancel30 on kernels without ppoll_time64 support 2024-04-23 21:18:04 +02:00
riscv login: Check default sizes of structs utmp, utmpx, lastlog 2024-04-19 18:38:23 +02:00
s390 s390x: Fix segfault in wcsncmp [BZ #31934] 2024-07-16 10:26:44 +02:00
sh login: structs utmp, utmpx, lastlog _TIME_BITS independence (bug 30701) 2024-04-19 18:38:24 +02:00
sparc login: structs utmp, utmpx, lastlog _TIME_BITS independence (bug 30701) 2024-04-19 18:38:24 +02:00
unix misc: Add support for Linux uio.h RWF_NOAPPEND flag 2024-05-29 14:20:58 +02:00
wordsize-32 Update copyright dates with scripts/update-copyrights 2023-01-06 21:14:39 +00:00
wordsize-64 hurd: Fix tst-writev test 2023-05-01 13:01:30 +02:00
x86 i386: Disable Intel Xeon Phi tests for GCC 15 and above (BZ 31782) 2024-05-28 09:33:22 -07:00
x86_64 x86_64: Optimize ffsll function code size. 2024-01-31 18:31:28 -08:00