Repository navigation
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
sys_wait4 ignored option bits it did not know, so wait4(pid, NULL, WEXITED) reaped the child. Linux fails that call with EINVAL, because only waitid takes WEXITED, and leaves the child for a later wait. box64 makes this call after a vfork, so a shell running under it got ECHILD from its own wait and reported status 255 for every child it started that way. Check the options first, as kernel_wait4 does.
xalestar
force-pushed
the
wait4-options
branch
from
December 1, 2026 14:33
9a784a5 to
6df2ce7
Compare
This was referenced Dec 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent: Make
wait4refuse the options that Linux refuses.Failure fixed:
wait4(pid, NULL, WEXITED)reaps the child on elfuse. Linux 6.18 returnsEINVALand leaves the child, because onlywaitidtakesWEXITED. box64 makes this call after avfork, sodashunder box64 gotECHILDfrom its own wait and reported 255 as the status of each command.This PR:
sys_wait4checks the option bits before it looks for a child, askernel_wait4does.__WCLONEwith an exited child, and on each valid bit paired with each unknown one.test-process-lifecycleWAIT-07 passes as is (3/3), fails with the fix reverted (3/3), and passes on Linux.dashunder box64 0.4.3, child exits 5: status 255 before, 5 after.make checkpasses.make test-matrix: elfuse-aarch64 338 passed, 0 failed; qemu-aarch64 312 passed, 0 failed.audit-known-limitationsfails in the Rosetta lane, and on d3c0785 too.Left out:
__WCLONEreaps an exited fork child where Linux returnsECHILD,waitidaccepts unknown options and none, andwait4(INT_MIN)returnsECHILDwhere Linux returnsESRCH.Refs #246
Summary by cubic
Rejects
wait4option bits that Linux refuses, so calls likewait4(pid, NULL, WEXITED)now returnEINVALon elfuse and leave the child instead of reaping it. Previouslysys_wait4ignored unknown options and consumed the child, which made shells under box64 seeECHILDfrom their own wait and report status 255 for every command.test-process-lifecycle, verifying all 32 option bits match Linux behavior.waitidhas the same gap for unknown options, andwait4(INT_MIN)returnsECHILDwhere Linux returnsESRCH.Written for commit 6df2ce7. Summary will update on new commits.