diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2020-02-17 19:11:39 +0100 |
---|---|---|
committer | Giuseppe Scrivano <gscrivan@redhat.com> | 2020-02-17 19:11:41 +0100 |
commit | e9dc2120925d9bc32b87ed3c4122aa40f7413db5 (patch) | |
tree | 9d7bf05f756da6e0cebd0f2c2712953c2f6b98fe | |
parent | ff0f8388138f7b66c4312db0e984f0bedcac2558 (diff) | |
download | podman-e9dc2120925d9bc32b87ed3c4122aa40f7413db5.tar.gz podman-e9dc2120925d9bc32b87ed3c4122aa40f7413db5.tar.bz2 podman-e9dc2120925d9bc32b87ed3c4122aa40f7413db5.zip |
rootless: check if the conmon process is valid
if the pause process doesn't exist and we try to join a conmon
namespace, make sure the process still exists. Otherwise re-create
the user namespace.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
-rw-r--r-- | pkg/rootless/rootless_linux.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/pkg/rootless/rootless_linux.go b/pkg/rootless/rootless_linux.go index 182a39f6b..f71d55776 100644 --- a/pkg/rootless/rootless_linux.go +++ b/pkg/rootless/rootless_linux.go @@ -452,6 +452,7 @@ func TryJoinFromFilePaths(pausePidPath string, needNewNamespace bool, paths []st var lastErr error var pausePid int + foundProcess := false for _, path := range paths { if !needNewNamespace { @@ -502,12 +503,16 @@ func TryJoinFromFilePaths(pausePidPath string, needNewNamespace bool, paths []st } pausePid, err = strconv.Atoi(string(b[:n])) - if err == nil { + if err == nil && unix.Kill(pausePid, 0) == nil { + foundProcess = true lastErr = nil break } } } + if !foundProcess { + return BecomeRootInUserNS(pausePidPath) + } if lastErr != nil { return false, 0, lastErr } |