Skip to content

[1.5] fix(libcontainer): preserve rootfs slave propagation for rslave containers - #5458

Open
kolyshkin wants to merge 2 commits into
opencontainers:release-1.5from
kolyshkin:1.5-5200
Open

kolyshkin wants to merge 2 commits into
opencontainers:release-1.5from
kolyshkin:1.5-5200

Conversation

@kolyshkin

Copy link
Copy Markdown
Contributor

Backport of #5200 to release-1.5. Original description follows.


When rootfsPropagation is set to rslave, prepareRoot() was forcing the rootfs parent mount to MS_PRIVATE before bind-mounting and pivoting into the rootfs. That breaks the slave relationship needed for HostToContainer propagation, so later unmount/remount events on host mountpoints under the rootfs are not reflected inside the running container.

Fix this by keeping the rootfs parent mount as MS_SLAVE for slave-like rootfs propagation settings, while leaving the final root propagation remount in place.

Fixes: #5192

@kolyshkin kolyshkin added this to the 1.5.2 milestone Sep 13, 2026
@kolyshkin kolyshkin added kind/bug backport/1.5-pr A backport PR to release-1.5 labels Sep 13, 2026
When rootfsPropagation is set to rslave, prepareRoot() was forcing the
rootfs parent mount to MS_PRIVATE before bind-mounting and pivoting into
the rootfs. That breaks the slave relationship needed for HostToContainer
propagation, so later unmount/remount events on host mountpoints under
the rootfs are not reflected inside the running container.

Fix this by keeping the rootfs parent mount as MS_SLAVE for slave-like
rootfs propagation settings, while leaving the final root propagation
remount in place.

Signed-off-by: sean <xujihui1985@gmail.com>
(cherry picked from commit ec170d8)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
add bat integration test for rootfs propagation test, expect to
see the mount propagation is slave, the test will create a isolate mntns
to run the test as the test will mutate the rootfs propagation

Signed-off-by: sean <xujihui1985@gmail.com>
(cherry picked from commit 38245cc)
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

backport/1.5-pr A backport PR to release-1.5 kind/bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants