criu/compel
Igor Svilenkov Bozic 2f676d20e4 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>
2025-12-07 19:20:00 +01:00
..
arch compel: gcs: set up GCS token/restorer for rt_sigreturn 2025-12-07 19:20:00 +01:00
include compel: gcs: initial GCS support for signal frames 2025-12-07 19:20:00 +01:00
plugins compel: infect: prepare parasite_service() for addition of CET support 2024-09-11 16:02:11 -07:00
src compel: flush caches after parasite injection 2025-11-02 07:48:23 -08:00
test compel: fix the stack test 2025-11-02 07:42:55 -08:00
.gitignore compel: fix gitignore and remove autogenerated code 2025-03-21 12:40:31 -07:00
compel-host compel cli: show includes 2017-03-15 00:09:55 +03:00
Makefile compel: add riscv64 support 2025-03-21 12:40:31 -07:00