criu/compel
Igor Svilenkov Bozic d591e320e0 criu/restore: gcs: adds restore implementation for Guarded Control Stack
This commit finalizes AArch64 Guarded Control Stack (GCS)
support by wiring the full dump and restore flow.

The restore path adds the following steps:

 - Define shared AArch64 GCS types and constants in a dedicated header
   for both compel and CRIU inclusion
 - compel: add get/set NT_ARM_GCS via ptrace, enabling user-space
   GCS state save and restore.
 - During restore switch to the new GCS (via GCSSTR) to place capability
   token sa_restorer address
 - arch_shstk_trampoline() — We enable GCS in a trampoline that using
   prctl(PR_SET_SHADOW_STACK_STATUS, ...) via inline SVC. The trampoline
   ineeded because we can’t RET without a valid GCS.
 - restorer: map the recorded GCS VMA, populate contents top-down with
   GCSSTR, write the signal capability at GCSPR_EL0 and the valid token at
   GCSPR_EL0-8, then switch to the rebuilt GCS (GCSSS1)
 - Save and restore registers via ptrace
 - Extend restorer argument structures to carry GCS state
   into post-restore execution
 - Add shstk_set_restorer_stack(): sets tmp_gcs to temporary restorer
   shadow stack start
 - Add gcs_vma_restore implementation (required for mremap of the GCS VMA)

Tested with:
    GCS_ENABLE=1 ./zdtm.py run -t zdtm/static/env00

Signed-off-by: Igor Svilenkov Bozic <svilenkov@gmail.com>
2025-12-07 19:20:00 +01:00
..
arch criu/restore: gcs: adds restore implementation for Guarded Control Stack 2025-12-07 19:20:00 +01:00
include criu/restore: gcs: adds restore implementation for Guarded Control Stack 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: gcs: add opt-in GCS test support for AArch64 2025-12-07 19:20:00 +01: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