summaryrefslogtreecommitdiff
path: root/libpod/runtime.go
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2021-10-28 11:18:48 +0200
committerMatthew Heon <matthew.heon@pm.me>2021-11-12 11:08:25 -0500
commit2d6252b98a94482346cc8dd16f97b4c59d16dc4d (patch)
treedeb5e0b73f194d451a01338e64890b99f49a1134 /libpod/runtime.go
parenta208bc24de85f78129859586571fcf25b6793f9e (diff)
downloadpodman-2d6252b98a94482346cc8dd16f97b4c59d16dc4d.tar.gz
podman-2d6252b98a94482346cc8dd16f97b4c59d16dc4d.tar.bz2
podman-2d6252b98a94482346cc8dd16f97b4c59d16dc4d.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.go4
1 files changed, 1 insertions, 3 deletions
diff --git a/libpod/runtime.go b/libpod/runtime.go
index a99f55fb3..a208b6db4 100644
--- a/libpod/runtime.go
+++ b/libpod/runtime.go
@@ -543,9 +543,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)
}
}