Skip to content

libct: don't change host mounts propagation - #5537

Open
kolyshkin wants to merge 1 commit into
opencontainers:mainfrom
kolyshkin:kir/host-mntns-prop
Open

kolyshkin wants to merge 1 commit into
opencontainers:mainfrom
kolyshkin:kir/host-mntns-prop

Conversation

@kolyshkin

Copy link
Copy Markdown
Contributor

When the container does not have its own mount namespace, prepareRoot is run in the host mount namespace. Since commit 91ca331 (#1702, which made runc chroot into the container rootfs when there is no mount namespace), this results in host's / being recursively made a slave (which, in the host mount namespace, means private), and the parent mount of the container rootfs being made private (or slave).

In the host mount namespace, do not change the propagation of the existing mounts. Instead, make the new rootfs mount a slave, so that container mounts do not propagate to the host and other mount namespaces (otherwise, if the rootfs parent mount is shared, every container mount appears twice in the host mount namespace, and is propagated to all its slaves).

Add an integration test.

Related to #3118, #2095.

When the container does not have its own mount namespace, prepareRoot
is run in the host mount namespace. Since commit 91ca331 ("chroot when
no mount namespaces is provided"), this results in host's / being
recursively made a slave (which, in the host mount namespace, means
private), and the parent mount of the container rootfs being made
private (or slave).

In the host mount namespace, do not change the propagation of the
existing mounts. Instead, make the new rootfs mount a slave, so that
container mounts do not propagate to the host and other mount
namespaces (otherwise, if the rootfs parent mount is shared, every
container mount appears twice in the host mount namespace, and is
propagated to all its slaves).

Add an integration test.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
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