CRIU provides support for checkpointing and restoring AppArmor security profiles and namespaces. This is a critical feature for containerized environments (like Docker, LXC, or Podman) where each container frequently operates under its own set of specialized security policies.
AppArmor integration in CRIU ensures that restored processes continue to operate under the same security constraints as the original processes, while also managing the temporary permissions needed for the checkpointing process itself.
During the dump phase, CRIU detects the AppArmor state of each task:
unconfined, docker-default, or a custom user-defined profile)./sys/kernel/security/apparmor/policy/ directory to capture the full hierarchy of namespaces and the raw binary blobs of all loaded policies.Restoring AppArmor state involves re-establishing the security context before the process resumes:
apparmor_parser utility on the destination host to re-load the policy blobs captured in the image files.aa_change_profile() interface before the application code begins executing.Modern AppArmor implementations support Profile Stacking, where multiple security profiles are applied to a single process simultaneously (e.g., a container-wide profile plus a per-application profile). CRIU correctly identifies, dumps, and restores these complex stacked configurations.
Reliable AppArmor C/R requires:
CONFIG_SECURITY_APPARMOR enabled and active.securityfs filesystem mounted (typically at /sys/kernel/security).