Skip to content

Commit

Permalink
When attempting to kill a dead processes, do not return failure
Browse files Browse the repository at this point in the history
A race exists where a container engine tells crun to kill a container,
process, where the process already died. In this case do not return
an error.

Fixes: containers/podman#18452

Signed-off-by: Daniel J Walsh <[email protected]>
  • Loading branch information
rhatdan committed Aug 26, 2023
1 parent a073199 commit da8ca09
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/libcrun/linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -5374,6 +5374,10 @@ libcrun_kill_linux (libcrun_container_status_t *status, int signal, libcrun_erro
if (errno == ENOSYS)
return libcrun_kill_linux_no_pidfd (status, true, signal, err);

/* when pidfd_open fails with ESRCH the process is already dead */
if (errno == ESRCH)
return 0

return crun_make_error (err, errno, "open pidfd");
}

Expand Down

0 comments on commit da8ca09

Please sign in to comment.