]> git.ipfire.org Git - thirdparty/glibc.git/commit
aarch64: Add GCS support for makecontext
authorSzabolcs Nagy <szabolcs.nagy@arm.com>
Tue, 4 Apr 2023 09:42:21 +0000 (10:42 +0100)
committerYury Khrustalev <yury.khrustalev@arm.com>
Thu, 10 Oct 2024 12:40:35 +0000 (13:40 +0100)
commit491de01415ff69bec912577d36ce1eab82d3514f
tree82a64dcf1e7f221c80834ab5ce1570aa1d7313e0
parentc03f6bdca242de927e6c5ad93be5e5760312fc06
aarch64: Add GCS support for makecontext

Changed the makecontext logic: previously the first setcontext jumped
straight to the user callback function and the return address is set
to __startcontext. This does not work when GCS is enabled as the
integrity of the return address is protected, so instead the context
is setup such that setcontext jumps to __startcontext which calls the
user callback (passed in x20).

The map_shadow_stack syscall is used to allocate a suitably sized GCS
(which includes some reserved area to account for altstack signal
handlers and otherwise supports maximum number of 16 byte aligned
stack frames on the given stack) however the GCS is never freed as
the lifetime of ucontext and related stack is user managed.
sysdeps/unix/sysv/linux/aarch64/makecontext.c
sysdeps/unix/sysv/linux/aarch64/setcontext.S