A pidfd is a file descriptor that refers to a specific process. Unlike traditional numeric PIDs, which can be reused by the kernel once a process terminates, a pidfd is a stable and race-free handle. It remains valid as long as the descriptor is open, even after the process it refers to has died. CRIU provides full support for checkpointing and restoring pidfds owned by applications.
CRIU treats pidfds as a specialized type of file descriptor. During a dump, it captures both the target of the pidfd and its configuration.
When CRIU encounters a pidfd in a process’s file descriptor table:
/proc/$pid/fdinfo/$fd to determine the numeric PID that the pidfd currently refers to.O_NONBLOCK or O_CLOEXEC).Restoring a pidfd involves recreating a handle that points to the equivalent process in the newly restored tree.
pidfd_open() system call on the restored PID of that task.pidfsThe underlying implementation of pidfds in the Linux kernel has changed over time:
/proc/$pid/fd, they appeared as anon_inode:[pidfd]./proc as pidfd:[N].CRIU automatically detects these kernel differences and handles both formats transparently, ensuring that pidfds are correctly identified and restored regardless of the host kernel version.
PIDFD_THREAD flag) is currently not implemented.