diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2021-10-28 11:18:48 +0200 |
---|---|---|
committer | Giuseppe Scrivano <gscrivan@redhat.com> | 2021-10-28 11:18:48 +0200 |
commit | 960831f9c8ff83f427c296adcef0ed114c434fca (patch) | |
tree | 621198a15e4e65bc33ef40646395a33f418b171d /libpod/runtime.go | |
parent | a05a445f48877006bccf9cd5399279cdfec7a790 (diff) | |
download | podman-960831f9c8ff83f427c296adcef0ed114c434fca.tar.gz podman-960831f9c8ff83f427c296adcef0ed114c434fca.tar.bz2 podman-960831f9c8ff83f427c296adcef0ed114c434fca.zip |
runtime: change PID existence check
commit 6b3b0a17c625bdf71b0ec8b783b288886d8e48d7 introduced a check for
the PID file before attempting to move the PID to a new scope.
This is still vulnerable to TOCTOU race condition though, since the
PID file or the PID can be removed/killed after the check was
successful but before it was used.
Closes: https://github.com/containers/podman/issues/12065
[NO NEW TESTS NEEDED] it fixes a CI flake
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'libpod/runtime.go')
-rw-r--r-- | libpod/runtime.go | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/libpod/runtime.go b/libpod/runtime.go index 950ac65eb..b01f8dd13 100644 --- a/libpod/runtime.go +++ b/libpod/runtime.go @@ -545,9 +545,7 @@ func makeRuntime(ctx context.Context, runtime *Runtime) (retErr error) { if became { // Check if the pause process was created. If it was created, then // move it to its own systemd scope. - if _, err = os.Stat(pausePid); err == nil { - utils.MovePauseProcessToScope(pausePid) - } + utils.MovePauseProcessToScope(pausePid) os.Exit(ret) } } |