fix(process): align wait and ptrace child semantics#1983
Merged
fslongjin merged 2 commits intoJun 22, 2026
Merged
Conversation
Refactor wait child selection away from the kill-only PID converter and introduce a wait-specific selector that models wait4 and waitid rules directly. This keeps P_ALL, P_PID, P_PGID and the current P_PIDFD boundary in the wait layer instead of leaking waitid semantics into sys_kill. Split natural-child and ptrace-child handling into explicit wait relations. Natural P_PID waits now resolve through the thread-group leader while ptrace waits resolve by task PID, matching Linux's TGID/PID split. The scan path also handles __WCLONE, __WALL and __WNOTHREAD without relying on test-specific shortcuts. Add a small ptrace relation module for PTRACE_TRACEME, tracee ownership, relation cleanup and wait-side checks. The relation is protected by a shared lock so wait cannot observe half-published ptrace state, and TRACEME uses the actual fork parent when a worker thread creates the child. Tighten event reporting and reaping. Zombie ownership is acquired before user-visible return data is filled, stopped and continued notifications are consumed with a single sighand lock operation, and zombie group leaders with live subthreads stay waitable without being reaped early. Extend wait_rusage dunitests to cover ptrace TRACEME, repeated TRACEME denial, __WNOTHREAD behavior, delayed group leader reaping, natural TID wait rejection, waitid option filtering and the current negative P_PIDFD errno boundary. Signed-off-by: longjin <longjin@dragonos.org>
Remove blocklist entries now covered by wait/ptrace compatibility fixes. Signed-off-by: longjin <longjin@dragonos.org> Co-authored-by: Cursor <cursoragent@cursor.com>
Member
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
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.
Summary
This PR refactors wait child selection and ptrace child handling to better match Linux wait semantics.
Validation
Notes
P_PIDFD support remains an explicit future compatibility boundary beyond the currently covered errno validation. Full ptrace attach/detach and traced-stop semantics are also outside this minimal TRACEME relation change.
Related to: #1850