summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2019-06-06 15:32:37 +0200
committerGiuseppe Scrivano <gscrivan@redhat.com>2019-06-06 15:32:45 +0200
commit4dca13e70423e657aec98999d9c6803075359517 (patch)
treefaa0a37402afb66bfdaaf70057fb084bd79ef4d3
parent6d285b879c3fa252545b15a3dea816426ba2c610 (diff)
downloadpodman-4dca13e70423e657aec98999d9c6803075359517.tar.gz
podman-4dca13e70423e657aec98999d9c6803075359517.tar.bz2
podman-4dca13e70423e657aec98999d9c6803075359517.zip
rootless: skip NS_GET_PARENT on old kernels
on old kernels the ioctl NS_GET_PARENT is not available. Handle the error code and immediately return the same fd. It should be fine now that we use the namespace resolution using the conmon pid, so the namespace parent resolution is just a safety measure. Closes: https://github.com/containers/libpod/issues/2968 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
-rw-r--r--pkg/rootless/rootless_linux.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/pkg/rootless/rootless_linux.go b/pkg/rootless/rootless_linux.go
index d302b1777..0cac50fc0 100644
--- a/pkg/rootless/rootless_linux.go
+++ b/pkg/rootless/rootless_linux.go
@@ -169,6 +169,9 @@ func getUserNSFirstChild(fd uintptr) (*os.File, error) {
for {
nextFd, err := getParentUserNs(fd)
if err != nil {
+ if err == syscall.ENOTTY {
+ return os.NewFile(fd, "userns child"), nil
+ }
return nil, errors.Wrapf(err, "cannot get parent user namespace")
}