glibc/sysdeps
Szabolcs Nagy 13cbbb0cb2 aarch64: Define jmp_buf offset for GCS
The target specific internal __longjmp is called with a __jmp_buf
argument which has its size exposed in the ABI. On aarch64 this has
no space left, so GCSPR cannot be restored in longjmp in the usual
way, which is needed for the Guarded Control Stack (GCS) extension.

setjmp is implemented via __sigsetjmp which has a jmp_buf argument
however it is also called with __pthread_unwind_buf_t argument cast
to jmp_buf (in cancellation cleanup code built with -fno-exception).
The two types, jmp_buf and __pthread_unwind_buf_t, have common bits
beyond the __jmp_buf field and there is unused space there which we
can use for saving GCSPR.

For this to work some bits of those two generic types have to be
reserved for target specific use and the generic code in glibc has
to ensure that __longjmp is always called with a __jmp_buf that is
embedded into one of those two types. Morally __longjmp should be
changed to take jmp_buf as argument, but that is an intrusive change
across targets.

Note: longjmp is never called with __pthread_unwind_buf_t from user
code, only the internal __libc_longjmp is called with that type and
thus the two types could have separate longjmp implementations on a
target. We don't rely on this now (but might in the future given that
cancellation unwind does not need to restore GCSPR).

Given the above this patch finds an unused slot for GCSPR. This
placement is not exposed in the ABI so it may change in the future.
This is also very target ABI specific so the generic types cannot
be easily changed to clearly mark the reserved fields.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
2025-01-20 09:22:41 +00:00
..
aarch64 aarch64: Define jmp_buf offset for GCS 2025-01-20 09:22:41 +00:00
alpha math: update alpha ulps 2025-01-05 20:02:53 +01:00
arc arc: Update libm test ulps 2025-01-15 11:41:30 +00:00
arm math: update arm ulps 2025-01-17 19:36:22 +00:00
csky Move <thread_pointer.h> to kernel-independent sysdeps directories 2025-01-09 19:30:16 +01:00
generic Add generic 'extra TLS' 2025-01-10 20:19:28 +00:00
gnu Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
hppa Move <thread_pointer.h> to kernel-independent sysdeps directories 2025-01-09 19:30:16 +01:00
htl htl: move pthread_mutexattr_setprioceiling, pthread_mutexattr_getprioceiling into libc. 2025-01-02 01:20:21 +01:00
hurd Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
i386 nptl: Introduce <rseq-access.h> for RSEQ_* accessors 2025-01-10 20:20:17 +00:00
ieee754 math: Fix acosf when building with gcc <= 11 2025-01-09 12:53:58 -03:00
loongarch Move <thread_pointer.h> to kernel-independent sysdeps directories 2025-01-09 19:30:16 +01:00
m68k Add missing include guards to <dl-tls.h> 2025-01-10 19:02:47 +01:00
mach hurd: Fix EINVAL error on linking to a slash-trailing path [BZ #32569] 2025-01-19 15:11:44 +01:00
microblaze Move <thread_pointer.h> to kernel-independent sysdeps directories 2025-01-09 19:30:16 +01:00
mips Add missing include guards to <dl-tls.h> 2025-01-10 19:02:47 +01:00
nptl nptl: Remove g_refs from condition variables 2025-01-17 14:56:58 -05:00
or1k Move <thread_pointer.h> to kernel-independent sysdeps directories 2025-01-09 19:30:16 +01:00
posix Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
powerpc Move <thread_pointer.h> to kernel-independent sysdeps directories 2025-01-09 19:30:16 +01:00
pthread Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
riscv Add missing include guards to <dl-tls.h> 2025-01-10 19:02:47 +01:00
s390 Add missing include guards to <dl-tls.h> 2025-01-10 19:02:47 +01:00
sh elf: Introduce generic <dl-tls.h> 2025-01-02 13:45:27 +01:00
sparc Move <thread_pointer.h> to kernel-independent sysdeps directories 2025-01-09 19:30:16 +01:00
unix Linux: Add tests that check that TLS and rseq area are separate 2025-01-16 20:02:42 +01:00
wordsize-32 Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
wordsize-64 Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
x86 x86: Add missing #include <features.h> to <thread_pointer.h> 2025-01-09 19:30:41 +01:00
x86_64 x86-64: Cast __rseq_offset to long long int [BZ #32543] 2025-01-12 07:08:27 +08:00