CRIU supports checkpointing and restoring the Guarded Control Stack (GCS) feature on ARM64 (AArch64) architectures. GCS is a hardware-assisted shadow stack mechanism designed to prevent return-oriented programming (ROP) attacks by maintaining a protected stack of return addresses.
GCS support is integrated into CRIU’s architecture-specific code for AArch64 (arch/aarch64/gcs.c).
During the dump phase, CRIU detects if a task has GCS enabled by checking its CPU features and hardware capabilities (HWCAP_GCS).
ptrace(PTRACE_GETREGSET, ..., NT_ARM_GCS, ...) to retrieve the current GCS state.gcspr_el0: The current Guarded Control Stack Pointer.features_enabled: The GCS configuration flags (e.g., PR_SHADOW_STACK_ENABLE).Restoring GCS requires carefully re-establishing the shadow stack before the process resumes normal execution.
map_shadow_stack system call to recreate the shadow stack at its original virtual address.gcspr_el0 and flags) is integrated into the task’s restorer context.gcs_context entry into the signal frame used for the final sigreturn. This informs the kernel to switch to the restored shadow stack as the process resumes.GCS support in CRIU requires an ARM64 host and a kernel that supports the Guarded Control Stack ABI, typically including:
PR_SHADOW_STACK_ENABLE prctl support.map_shadow_stack system call.NT_ARM_GCS ptrace regset.