criu/compel/arch
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
..
aarch64 criu/restore: gcs: adds restore implementation for Guarded Control Stack 2025-12-07 19:20:00 +01:00
arm criu/restore: gcs: adds restore implementation for Guarded Control Stack 2025-12-07 19:20:00 +01:00
loongarch64 arm64: C/R PAC keys 2025-03-21 12:40:31 -07:00
mips compel/mips: Relax ELF magic check to support MIPS libraries 2025-11-02 07:48:23 -08:00
ppc64 arm64: C/R PAC keys 2025-03-21 12:40:31 -07:00
riscv64 arm64: C/R PAC keys 2025-03-21 12:40:31 -07:00
s390 arm64: C/R PAC keys 2025-03-21 12:40:31 -07:00
x86 compel: gcs: set up GCS token/restorer for rt_sigreturn 2025-12-07 19:20:00 +01:00