diff --git a/libcontainer/rootfs_linux.go b/libcontainer/rootfs_linux.go index 73ee2bd6..cf715d66 100644 --- a/libcontainer/rootfs_linux.go +++ b/libcontainer/rootfs_linux.go @@ -778,10 +778,10 @@ func remountReadonly(m *configs.Mount) error { // mounts ( proc/kcore ). // For files, maskPath bind mounts /dev/null over the top of the specified path. // For directories, maskPath mounts read-only tmpfs over the top of the specified path. -func maskPath(path string) error { +func maskPath(path string, mountLabel string) error { if err := unix.Mount("/dev/null", path, "", unix.MS_BIND, ""); err != nil && !os.IsNotExist(err) { if err == unix.ENOTDIR { - return unix.Mount("tmpfs", path, "tmpfs", unix.MS_RDONLY, "") + return unix.Mount("tmpfs", path, "tmpfs", unix.MS_RDONLY, label.FormatMountLabel("", mountLabel)) } return err } diff --git a/libcontainer/standard_init_linux.go b/libcontainer/standard_init_linux.go index 02ea753e..e74d8002 100644 --- a/libcontainer/standard_init_linux.go +++ b/libcontainer/standard_init_linux.go @@ -110,7 +110,7 @@ func (l *linuxStandardInit) Init() error { } } for _, path := range l.config.Config.MaskPaths { - if err := maskPath(path); err != nil { + if err := maskPath(path, l.config.Config.MountLabel); err != nil { return err } }