From 4dca13e70423e657aec98999d9c6803075359517 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Thu, 6 Jun 2019 15:32:37 +0200 Subject: 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 --- pkg/rootless/rootless_linux.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'pkg/rootless/rootless_linux.go') 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") } -- cgit v1.2.3-54-g00ecf