criu/compel/arch
Igor Svilenkov Bozic aa7ecdd48e
compel: gcs: set up GCS token/restorer for rt_sigreturn
When GCS is enabled, the kernel expects a capability token at GCSPR_EL0-8
and sa_restorer at GCSPR_EL0-16 on rt_sigreturn. The sigframe must be
consistent with the kernel’s expectations, with GCSPR_EL0 advanced by -8
having it point to the token on signal entry. On rt_sigreturn, the kernel
verifies the cap at GCSPR_EL0, invalidates it and increments GCSPR_EL0 by 8
at the end of gcs_restore_signal() .

Implement parasite_setup_gcs() to:
- read NT_ARM_GCS via ptrace(PTRACE_GETREGSET)
- write (via ptrace) the computed capability token and restorer address
- update GCSPR_EL0 to point to the token's location

Call parasite_setup_gcs() into parasite_start_daemon() so the sigreturn
frame satisfies kernel's expectation

Tests with GCS remain opt‑in:
	make -C compel/test/infect GCS_ENABLE=1 && make -C compel/test/infect run

Signed-off-by: Igor Svilenkov Bozic <svilenkov@gmail.com>
[ alex: cleanup fixes ]
Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
Acked-by: Mike Rapoport <rppt@kernel.org>
2026-07-21 13:40:17 +02:00
..
aarch64 compel: gcs: set up GCS token/restorer for rt_sigreturn 2026-07-21 13:40:17 +02:00
arm compel: fix sys_clock_gettime function signature 2026-07-19 19:11:28 +02:00
loongarch64 compel: fix sys_clock_gettime function signature 2026-07-19 19:11:28 +02:00
mips compel: fix sys_clock_gettime function signature 2026-07-19 19:11:28 +02:00
ppc64 compel: fix sys_clock_gettime function signature 2026-07-19 19:11:28 +02:00
riscv64 compel: fix sys_clock_gettime function signature 2026-07-19 19:11:28 +02:00
s390 compel: fix sys_clock_gettime function signature 2026-07-19 19:11:28 +02:00
x86 compel: gcs: set up GCS token/restorer for rt_sigreturn 2026-07-21 13:40:17 +02:00