Merge pull request #40946 from thaJeztah/19.03_backport_fix_selinux_enotsup

[19.03 backport] SELinux: fix ENOTSUP errors not being detected when relabeling
This commit is contained in:
Akihiro Suda 2020-05-12 00:33:11 +09:00 committed by GitHub
commit 0803200be9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 3 deletions

View file

@ -20,7 +20,6 @@ import (
"github.com/opencontainers/selinux/go-selinux/label"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"golang.org/x/sys/unix"
)
const (
@ -147,7 +146,7 @@ func (container *Container) CopyImagePathContent(v volume.Volume, destination st
logrus.Warnf("error while unmounting volume %s: %v", v.Name(), err)
}
}()
if err := label.Relabel(path, container.MountLabel, true); err != nil && err != unix.ENOTSUP {
if err := label.Relabel(path, container.MountLabel, true); err != nil && !errors.Is(err, syscall.ENOTSUP) {
return err
}
return copyExistingContents(rootfs, path)

View file

@ -113,7 +113,7 @@ func (m *MountPoint) Setup(mountLabel string, rootIDs idtools.Identity, checkFun
return
}
err = label.Relabel(sourcePath, mountLabel, label.IsShared(m.Mode))
if err == syscall.ENOTSUP {
if errors.Is(err, syscall.ENOTSUP) {
err = nil
}
if err != nil {