pkg/sysinfo: use containerd/sys to detect UserNamespaces
The implementation in libcontainer/system is quite complicated,
and we only use it to detect if user-namespaces are enabled.
In addition, the implementation in containerd uses a sync.Once,
so that detection (and reading/parsing `/proc/self/uid_map`) is
only performed once.
@@ -6,7 +6,7 @@ import (
"strings"
cgroupsV2 "github.com/containerd/cgroups/v2"
- rsystem "github.com/opencontainers/runc/libcontainer/system"
+ "github.com/containerd/containerd/sys"
"github.com/sirupsen/logrus"
)
@@ -146,6 +146,6 @@ func applyPIDSCgroupInfoV2(info *SysInfo, controllers map[string]struct{}, _ str
}
func applyDevicesCgroupInfoV2(info *SysInfo, controllers map[string]struct{}, _ string) []string {
- info.CgroupDevicesEnabled = !rsystem.RunningInUserNS()
+ info.CgroupDevicesEnabled = !sys.RunningInUserNS()
return nil
}
