libcontainer: default mount propagation correctly

The code in prepareRoot (e385f67a0e/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 https://github.com/moby/moby/issues/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 <euan.kemp@coreos.com>
This commit is contained in:
Euan Kemp 2017-09-22 02:31:17 -07:00
parent 3f2f8b84a7
commit 4301b440d6
1 changed files with 1 additions and 1 deletions

View File

@ -37,7 +37,7 @@ var mountPropagationMapping = map[string]int{
"slave": unix.MS_SLAVE,
"rshared": unix.MS_SHARED | unix.MS_REC,
"shared": unix.MS_SHARED,
"": unix.MS_PRIVATE | unix.MS_REC,
"": 0,
}
var allowedDevices = []*configs.Device{