Repository navigation
fix(containment): permit waitid so a Go program can wait for its child - #447
Merged
Merged
Conversation
## Problem The Linux permit filter refuses `waitid` with `EPERM`. Go's `os/exec` calls `waitid` before it reaps a child with `wait4`, so every child of a Go program fails. In a box, `gh pr create` and `gh pr status` stop with `failed to run git: waitid: operation not permitted`. ## Solution Add `waitid` to `WORKLOAD_PERMITTED`, unrestricted, like `wait4`. The kernel limits both calls to the caller's own children, and the `P_PIDFD` form takes a descriptor from the permitted `pidfd_open`. No interface moves. The containment `AGENTS.md` records the measurement. ## Tests - `a_child_is_awaited_with_waitid_under_the_filters` forks a child under the filters and waits for it with `P_ALL` and `WNOHANG`, `P_PIDFD`, and `P_PID`. Without the permit it fails with code 10. - `child_waits_are_permitted_and_unmediated` checks that `wait4` and `waitid` are in the permit table and the compiled permit filter, and not in the restriction filter. Without the permit it fails. - `cargo test -p strands-box-containment --all-features` passes on ARM64 Amazon Linux 2023. x86-64 did not run locally. - In a box built by staging-boxy main with this Box, `gh` 2.103.3 runs `gh pr create --dry-run`, `gh pr status`, and `gh repo view` and exits 0. On Box `70eb3afc` the first two fail with the `waitid` error.
|
Assessment: Approve I found no correctness, scope, or premise issues in Checked and held
The fix is small, the test can fail when it should, and the measurement is recorded where the containment guide asks for it. |
priyasingh2111
approved these changes
Nov 13, 2026
This was referenced Nov 13, 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.
Description
In a box on Linux, any Go program that starts a child fails.
gh pr createandgh pr statusstop withfailed to run git: waitid: operation not permitted. Go'sos/execcallswaitidbefore it reaps the child withwait4, and the permit filter refuseswaitid.This change adds
waitidtoWORKLOAD_PERMITTED, unrestricted, likewait4.gh(and other Go tools) can rungitand other children in a Linux box.waitidto the caller's own children, as it doeswait4. ItsP_PIDFDform takes a descriptor frompidfd_open, which the filter already permits. No reach is added.AGENTS.mdrecords the measurement under "Waiting for a child".crates/containment/AGENTS.md. No user page lists the permit table.Related Issues
None.
Type of Change
Bug fix
Testing
a_child_is_awaited_with_waitid_under_the_filters(P_ALL+WNOHANG,P_PIDFD,P_PID)EPERM)child_waits_are_permitted_and_unmediatedgh2.103.3 in a box:gh pr create --dry-run --head <branch>waitid: operation not permittedghin a box:gh pr statuswaitid: operation not permittedghin a box:gh repo view1152aab) and itscorpus-githubprofile, against strands-agents/staging-boxy. Nothing was written to GitHub.70eb3afc(this PR's base). "With" is the same build patched to this branch.cargo test,cargo clippy --all-targetsandcargo fmt --checkpass forstrands-box-containmentwith--all-features.ghran in a box. The unit test covers thewaitidforms Go uses.Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.