Repository navigation
fix(minimald,sandbox): every sandbox that the daemon starts in a box's classifier leaf has its - #3711
Draft
minimal-foundry[bot] wants to merge 2 commits into
Draft
minimal-foundry[bot] wants to merge 2 commits into
minimal-foundry[bot] wants to merge 2 commits into
Conversation
run_with_cancel holds the program at a start gate, moves the supervisor into the leaf with classifier::place_supervisor, and reads the leaf back. A supervisor that is not in the leaf fails the run, which kills and reaps the process.
The task launch moves each invocation's supervisor into the leaf of its box after the spawn. A failed move kills and reaps the process and fails the task with the cause. place_box_processes now calls the sandbox function, so a box launch, a build and a task share one placement.
Contributor
|
Important Review skippedBot user detected. Ask an organization administrator to verify that this bot has an active assigned CodeRabbit review seat. See the seat-assignment guide. After the seat is confirmed, request a review again.
|
This branch has not been deployed
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.Ad
30A8
d 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.
Follow-up
Fixes #3696
crates/sandbox/src/lib.rscrates/minimald/src/exec/process.rscrates/minimald/src/exec/tests.rscrates/minimald/src/box_runtime/enforcement.rscrates/minimald/tests/classifier_root_integration.rsTask marker
Proof
While a package build or a task runs for a host-address box, the cgroup.procs of the box's leaf lists the sandbox supervisor next to the program. The daemon moves the supervisor in after the spawn and reads the leaf back. A supervisor that the leaf does not list stops the run: the daemon kills and reaps the process, and the build or task fails with the cause. package_build_in_a_box_leaf_follows_its_verdict_over_a_loaded_table now asserts that the leaf lists the build's supervisor while the build runs. This box did not run that assertion (see notes).
Notes from the agent: One function now moves and confirms a supervisor: sandbox::classifier::place_supervisor, with leaf_lists_pid moved beside it. place_box_processes calls it, and enforcement.rs re-exports leaf_lists_pid for the existing box_runtime tests. run_with_cancel holds the program at a start gate (Sandbox::hold_start) when the config has a leaf, places the supervisor, then releases the gate. The task launch in exec/process.rs cannot hold a start gate, because mctx::Env exposes no hold_start and crates/mctx is outside the layers. So place_supervisor treats a failure for a supervisor in state Z or X as Ok: a fast task can exit before the move, and an exited supervisor is not a process left outside the leaf. A follow-up can add a start gate to the mctx Env so the task path holds its program too. The root integration probe now sleeps 500 ms at start so the watch thread can read the leaf while the build is alive. New printed text (task refusal, pinned in a_task_supervisor_the_leaf_refuses_stops_the_task): "the task did not start: Minimal could not move the task's supervisor process into the cgroup that decides the box's network access. The cgroup no longer exists. If it keeps failing, run
min bugto collect a diagnostic bundle." It follows the existing box-launch refusal text. Not run here: just test-root-integration (its gvproxy prerequisite needs network, and the lane needs root and a classifier tr…[truncated]Tests
cargo test -p sandbox a_run_in_a_classifier_leaf_places_its_supervisorcargo test -p minimald a_task_supervisor_the_leaf_refuses_stops_the_taskjust test-root-integrationVerify
min task run agent-verifyexited 100, so this PR is a draft.