Repository navigation
darwin: Keep parent's end of the helper control socket out of the helper - #1266
Merged
Merged
Conversation
oleavr
force-pushed
the
fix/darwin-helper-parent-socket-cloexec
branch
from
October 18, 2026 11:10
d57dfc4 to
4c78da4
Compare
Member
|
w00t! Thanks! 🙌 |
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.
The helper is spawned with LEAVE_DESCRIPTORS_OPEN so the fd carrying its end of the control socketpair survives the exec. The parent's end was not marked close-on-exec, so the helper inherited that too. When the parent went away without an orderly stop, the helper's own copy of the parent's end kept the connection alive, the connection never closed, and the helper lingered forever, along with anything it had spawned.
Mark the parent's end close-on-exec. The helper's existing shutdown path, which fires when the connection closes and the backend is idle, then takes care of the rest.
Add a test that spawns through the local device and checks the helper's descriptor table for a socket connected to another of its own descriptors.
Simple reproducer
Run it, then check the helper it printed: