[MEDIUM] Do not treat stopped children as exited - #201
Open
OskarEichler wants to merge 2 commits into
Open
OskarEichler wants to merge 2 commits into
OskarEichler wants to merge 2 commits into
Conversation
Contributor
|
Would need a test demonstrating the issue |
Author
|
Added a real lifecycle regression: it starts a child, sends SIGSTOP, waits until |
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
Stops treating a merely suspended POSIX child as exited by removing
WUNTRACEDfrom nonblocking exit polling.Security impact
MEDIUM: an untrusted or compromised child can suspend itself.
waitpid2(..., WNOHANG | WUNTRACED)then reports the stopped PID, and ChildProcess returnstruefromexited?even though the process still exists.poll_for_exitand the graceful phase ofstopcan therefore report completion without escalating toKILL, leaving the child and its resources present after the supervisor believes termination succeeded.Waiting only for termination preserves the intended contract: stopped children remain alive until continued or killed.
Reproduction
On 5.1.0, start a Ruby child that sends itself
STOP, wait for suspension, and callexited?. The baseline returnstrue; this branch returnsfalse.Verification
git diff --checkpasses.All Ruby-backed checks used rbenv.
Limitations
The regression exercise is POSIX-specific. Windows, JRuby, and TruffleRuby were not run locally; the change uses the existing portable
waitpid2interface and only removes the stopped-child flag.Breaking changes
Code that relied on
exited?returning true for a suspended child will now receive false, matching the documented termination meaning. Public signatures are unchanged.