Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/libcrun/container.c
Original file line number Diff line number Diff line change
Expand Up @@ -2025,9 +2025,10 @@ container_delete_internal (libcrun_context_t *context, libcrun_container_t *cont
{
errno = crun_error_get_errno (err);

/* pidfd_open returns EINVAL if the process is not a thread-group leader.
In our case it means the process already exited, so handle as ESRCH. */
if (errno != ESRCH && errno != EINVAL)
/* pidfd_open returns EINVAL (ENOENT since Linux 6.16) if the process
is not a thread-group leader. In our case it means the process
already exited, so handle as ESRCH. */
if (errno != ESRCH && errno != EINVAL && errno != ENOENT)
return ret;

crun_error_release (err);
Expand Down
8 changes: 6 additions & 2 deletions src/libcrun/linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -8070,8 +8070,12 @@ libcrun_kill_linux (libcrun_container_status_t *status, int signal, libcrun_erro
return libcrun_kill_linux_no_pidfd (status, true, signal, err);
if (errno == ESRCH)
return crun_make_error (err, errno, "process not running");
/* Check if the PID is valid before reporting an error. */
if (errno == EINVAL)
/* Check if the PID is valid before reporting an error. pidfd_open
fails for a pid that is not a thread-group leader, for example when
the container's pid was reused by a thread: with EINVAL before
Linux 6.16, with ENOENT since (commit 8cf4b738f6d8, "pidfd: improve
uapi when task isn't found"). */
Comment thread
usiegj00 marked this conversation as resolved.
Resolved
if (errno == EINVAL || errno == ENOENT)
{
int errno_saved = errno;
ret = libcrun_check_pid_valid (status, err);
Expand Down