Repository navigation
Conversation
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>
kolyshkin
force-pushed
the
kir/host-mntns-prop
branch
from
October 9, 2026 18:19
da93b11 to
b5dc8b7
Compare
This was referenced Oct 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the container does not have its own mount namespace,
prepareRootis 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.