Skip to content
This repository was archived by the owner on Jun 11, 2020. It is now read-only.

Commit 69663f0

Browse files
author
Mrunal Patel
authored
Merge pull request opencontainers#1756 from rhatdan/selinux1
Label the masked tmpfs with the mount label
2 parents 9facb87 + 43aea05 commit 69663f0

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

libcontainer/rootfs_linux.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -778,10 +778,10 @@ func remountReadonly(m *configs.Mount) error {
778778
// mounts ( proc/kcore ).
779779
// For files, maskPath bind mounts /dev/null over the top of the specified path.
780780
// For directories, maskPath mounts read-only tmpfs over the top of the specified path.
781-
func maskPath(path string) error {
781+
func maskPath(path string, mountLabel string) error {
782782
if err := unix.Mount("/dev/null", path, "", unix.MS_BIND, ""); err != nil && !os.IsNotExist(err) {
783783
if err == unix.ENOTDIR {
784-
return unix.Mount("tmpfs", path, "tmpfs", unix.MS_RDONLY, "")
784+
return unix.Mount("tmpfs", path, "tmpfs", unix.MS_RDONLY, label.FormatMountLabel("", mountLabel))
785785
}
786786
return err
787787
}

libcontainer/standard_init_linux.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func (l *linuxStandardInit) Init() error {
110110
}
111111
}
112112
for _, path := range l.config.Config.MaskPaths {
113-
if err := maskPath(path); err != nil {
113+
if err := maskPath(path, l.config.Config.MountLabel); err != nil {
114114
return err
115115
}
116116
}

0 commit comments

Comments
 (0)