Skip to content

Commit 4301b44

Browse files
committed
libcontainer: default mount propagation correctly
The code in prepareRoot (https://github.com/opencontainers/runc/blob/e385f67a0e45fa1d8ef8154e2aea5128ea1d331b/libcontainer/rootfs_linux.go#L599-L605) attempts to default the rootfs mount to `rslave`. However, since the spec conversion has already defaulted it to `rprivate`, that code doesn't actually ever do anything. This changes the spec conversion code to accept "" and treat it as 0. Implicitly, this makes rootfs propagation default to `rslave`, which is a part of fixing the moby bug moby/moby#34672 Alternate implementatoins include changing this defaulting to be `rslave` and removing the defaulting code in prepareRoot, or skipping the mapping entirely for "", but I think this change is the cleanest of those options. Signed-off-by: Euan Kemp <[email protected]>
1 parent 3f2f8b8 commit 4301b44

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libcontainer/specconv/spec_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ var mountPropagationMapping = map[string]int{
3737
"slave": unix.MS_SLAVE,
3838
"rshared": unix.MS_SHARED | unix.MS_REC,
3939
"shared": unix.MS_SHARED,
40-
"": unix.MS_PRIVATE | unix.MS_REC,
40+
"": 0,
4141
}
4242

4343
var allowedDevices = []*configs.Device{

0 commit comments

Comments
 (0)