Skip to content

criu: resolve the bind mounts in the running container - #2464

Open
giuseppe wants to merge 1 commit into
containers:mainfrom
giuseppe:ckpt-resolve-binds
Open

giuseppe wants to merge 1 commit into
containers:mainfrom
giuseppe:ckpt-resolve-binds

Conversation

@giuseppe

Copy link
Copy Markdown
Member

CRIU matches the external mounts by the mount point recorded in the mount table, but the destinations were resolved against the rootfs on the host. That differs from what the kernel did when the destination goes through a link of another mount of the container, or when the root path is relative to the bundle: the checkpoint fails with "doesn't have a proper root mount".

Resolve the destinations in the root of the running container and save them in the checkpoint, since the restore cannot resolve them without the container and fails with "No mapping for mountpoint".

CRIU knows the external mounts by their mount point, but the
destinations of the bind mounts were resolved under the rootfs on the
host.  When a destination goes through a link of another mount of the
container, or through a link in the rootfs with a root path relative to
the bundle, that is not the mount point and the checkpoint fails with:

  mnt: ./real/data doesn't have a proper root mount

Resolve the destinations as the kernel did when they were mounted: on
checkpoint in the root of the running container, on restore in the
rootfs where the mount points are already created in the same order as
on create, with the bind mounts done before.  Both use the same function,
so the restore gives CRIU the mount points recorded by the checkpoint.

Add checkpoint/restore tests with a link in the destination of a bind
mount, in the rootfs and in another mount.

Signed-off-by: Giuseppe Scrivano <giuseppe@scrivano.org>
@giuseppe
giuseppe marked this pull request as ready for review November 11, 2026 10:07
@giuseppe

Copy link
Copy Markdown
Member Author

The reproducer using just podman:

#!/bin/sh
S=/var/tmp/repro
mkdir -p $S/a/real/data $S/b; ln -s real $S/a/link
podman run -d --name t -v $S/a:/mnt -v $S/b:/mnt/link/data docker.io/library/alpine sleep 1000
podman container checkpoint t -e $S/t.tar
podman rm -f t
podman container restore -i $S/t.tar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant