aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux/tcsendbrk.c
diff options
context:
space:
mode:
authorSzabolcs Nagy <szabolcs.nagy@arm.com>2022-11-25 18:16:07 +0000
committerYury Khrustalev <yury.khrustalev@arm.com>2025-01-20 09:22:41 +0000
commit13cbbb0cb29153bab099e040002e7cc78a0ceaaa (patch)
treed7d20b306766268cea6dbc655baf404a3f5b485d /sysdeps/unix/sysv/linux/tcsendbrk.c
parent640c209a72b3a3d3712dffb8c728f6ce3c504715 (diff)
downloadglibc-13cbbb0cb29153bab099e040002e7cc78a0ceaaa.zip
glibc-13cbbb0cb29153bab099e040002e7cc78a0ceaaa.tar.gz
glibc-13cbbb0cb29153bab099e040002e7cc78a0ceaaa.tar.bz2
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>
Diffstat (limited to 'sysdeps/unix/sysv/linux/tcsendbrk.c')
0 files changed, 0 insertions, 0 deletions