Skip to content

linux: fix pidfd_open ENOENT errno support - #2394

Closed
usiegl00 wants to merge 1 commit into
containers:mainfrom
usiegl00:pidfd-returns-ENOENT
Closed

usiegl00 wants to merge 1 commit into
containers:mainfrom
usiegl00:pidfd-returns-ENOENT

Conversation

@usiegl00

@usiegl00 usiegl00 commented Oct 21, 2026 •

Copy link
Copy Markdown

In commit 8cf4b738f6d8, "pidfd: improve uapi when task
isn't found"
pidfd_open() now returns ENOENT instead of EINVAL when the
pid exists but is not the leader of a thread-group.

This occurs when the pid space wraps under significant pid churn.

The simple fix is to treat ENOENT the same as EINVAL when handling the
errno of pidfd_open. This prevents stopped containers from accumulating
when the pid space wraps.

ENOENT is returned in linux 6.15-rc2 and onwards.

@usiegl00
usiegl00 force-pushed the pidfd-returns-ENOENT branch from 836d0c0 to 4256e76 Compare October 21, 2026 06:58
@kolyshkin

Copy link
Copy Markdown
Collaborator

Thank you! Just one nit in the comment, otherwise LGTM

In commit 8cf4b738f6d8, "pidfd: improve uapi when task
isn't found" pidfd_open() now returns ENOENT instead of EINVAL when the
pid exists but is not the leader of a thread-group.

This occurs when the pid space wraps under significant pid churn.

The simple fix is to treat ENOENT the same as EINVAL when handling the
errno of pidfd_open. This prevents stopped containers from accumulating
when the pid space wraps.

Signed-off-by: usiegl00 <50933431+usiegl00@users.noreply.github.com>
@usiegl00
usiegl00 force-pushed the pidfd-returns-ENOENT branch from 4256e76 to 75fa6f3 Compare October 21, 2026 08:41
@usiegl00

Copy link
Copy Markdown
Author

@kolyshkin updated the comment to reflect the right version

@giuseppe

Copy link
Copy Markdown
Member

please use your real name and email for the commit author and DCO

@usiegl00 usiegl00 closed this Oct 21, 2026
giuseppe added a commit to giuseppe/crun that referenced this pull request Oct 21, 2026
In commit 8cf4b738f6d8, "pidfd: improve uapi when task isn't found"
pidfd_open() now returns ENOENT instead of EINVAL when the pid exists
but is not the leader of a thread-group.

Carried over from containers#2394

Signed-off-by: Giuseppe Scrivano <giuseppe@scrivano.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants