Skip to content
This repository was archived by the owner on Oct 13, 2023. It is now read-only.

Commit 6e7916b

Browse files
authored
Merge pull request #40946 from thaJeztah/19.03_backport_fix_selinux_enotsup
[19.03 backport] SELinux: fix ENOTSUP errors not being detected when relabeling Upstream-commit: 0803200be91a63314824c655adba76ea3c3717cb Component: engine
2 parents 7fdbfac + dab9e68 commit 6e7916b

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

components/engine/container/container_unix.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"github.com/opencontainers/selinux/go-selinux/label"
2121
"github.com/pkg/errors"
2222
"github.com/sirupsen/logrus"
23-
"golang.org/x/sys/unix"
2423
)
2524

2625
const (
@@ -147,7 +146,7 @@ func (container *Container) CopyImagePathContent(v volume.Volume, destination st
147146
logrus.Warnf("error while unmounting volume %s: %v", v.Name(), err)
148147
}
149148
}()
150-
if err := label.Relabel(path, container.MountLabel, true); err != nil && err != unix.ENOTSUP {
149+
if err := label.Relabel(path, container.MountLabel, true); err != nil && !errors.Is(err, syscall.ENOTSUP) {
151150
return err
152151
}
153152
return copyExistingContents(rootfs, path)

components/engine/volume/mounts/mounts.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ func (m *MountPoint) Setup(mountLabel string, rootIDs idtools.Identity, checkFun
113113
return
114114
}
115115
err = label.Relabel(sourcePath, mountLabel, label.IsShared(m.Mode))
116-
if err == syscall.ENOTSUP {
116+
if errors.Is(err, syscall.ENOTSUP) {
117117
err = nil
118118
}
119119
if err != nil {

0 commit comments

Comments
 (0)