[Bug 219947] New: Undocumented EAGAIN behavior for clone/pthread_create

bugzilla-daemon
2025-03-28T10:26:15Z

Bug ID: 219947
Summary: Undocumented EAGAIN behavior for clone/pthread_create
Product: Documentation
Version: unspecified
Hardware: All
OS: Linux
Status: NEW
Severity: normal
Priority: P3
Component: man-pages
Assignee: documentation_man-pages@kernel-bugs.osdl.org
Reporter: lennart.kramer@wibu.com
Regression: No

Currently, when a clone() is called with CLONE_FS (as is the case with
pthread_create), and concurrently in another thread, an execve() syscall is in
progress, the clone() call may return early with an EAGAIN error.

I think the corresponding location in the kernel returning EAGAIN is in
kernel/fork.c inside copy_fs.

The man pages currently only document cases of resource exhaustion (and a
SCHED_DEADLINE case which most people won't care about) under EAGAIN, in which
case aborting the process is reasonable, but in this case it can result in the
process exiting before the execve() syscall finishes.
This is nonsensical as the thread calling clone() was about to be deleted
anyway.