CRIU provides extensive support for checkpointing and restoring a wide variety of Linux network sockets, including Unix domain sockets, IPv4/IPv6 (TCP, UDP, RAW), Netlink, and Packet sockets.
To faithfully restore a socket, CRIU must capture its full kernel state:
SO_KEEPALIVE, SO_REUSEADDR, TCP_NODELAY, buffer sizes) are captured and reapplied.FIN_WAIT or CLOSE_WAIT for TCP).CRIU combines information from multiple sources to build a complete picture of each socket.
The primary source of truth is the sock_diag kernel module. CRIU sends Netlink requests to sock_diag to retrieve detailed internal state for most socket families. This provides protocol-level information that is not available via standard userspace APIs.
For deeper inspection—such as peeking at socket queues or enabling TCP repair mode—CRIU uses its parasite code to send the actual socket file descriptor to the CRIU process via a Unix domain socket using the SCM_RIGHTS mechanism. This allows the CRIU coordinator to perform ioctl, getsockopt, and recv(MSG_PEEK) calls directly on a local copy of the socket.
Restoring a TCP connection without disrupting the peer (and without sending any packets) is a major challenge. CRIU uses a specialized kernel feature called TCP Repair Mode:
Unix sockets are unique because they can be used to transfer other file descriptors. CRIU captures these “in-flight” descriptors (files that have been sent but not yet received) and ensures they are correctly re-queued for the restored process.