diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-02-17 21:15:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-17 21:15:41 +0100 |
commit | 0bd29f89e9d26c9012c76e58050e1bdfd90faaf0 (patch) | |
tree | 7ad65b9a0f953d9a3e824afc4c082fbbe0644889 | |
parent | 640b11f0028057ca2090d61c4e460c1afadb226c (diff) | |
parent | e9dc2120925d9bc32b87ed3c4122aa40f7413db5 (diff) | |
download | podman-0bd29f89e9d26c9012c76e58050e1bdfd90faaf0.tar.gz podman-0bd29f89e9d26c9012c76e58050e1bdfd90faaf0.tar.bz2 podman-0bd29f89e9d26c9012c76e58050e1bdfd90faaf0.zip |
Merge pull request #5237 from giuseppe/check-for-valid-conmon-process
rootless: check if the conmon process is valid
-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 } |