fix(jaild): fail closed when the read-only remount fails (AB-003) - #304
Merged
Conversation
WHAT: In run_jailed's async-signal-safe pre_exec closure, the RO remount (MS_BIND|MS_REMOUNT|MS_RDONLY) discarded its return value — unlike every other syscall in the closure, which fails closed via the errno pipe. If the remount failed (EACCES/EPERM/EINVAL), the path was left READ-WRITE and the closure proceeded to pivot_root and exec: the jail's effective authority exceeded the caveat. Capture the return code and `return Err` on failure. WHY: #266 / AB-003 — a fail-open confinement breach (a would-be read-only path stays writable). Regression: a test-only fault seam (FAULT_RO_REMOUNT) forces the remount to fail; the privileged `ro_remount_failure_fails_closed` test (linux tier, like the other jaild E2E proofs) asserts run_jailed then fails closed rather than exec'ing. Reverting the `return Err` re-fails the test. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
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
Fixes #266 / AB-003. In
run_jailed's async-signal-safepre_execclosure, the read-only remount (MS_BIND|MS_REMOUNT|MS_RDONLY) discarded its return value — unlike every other syscall in the closure, which fails closed via the errno pipe. If that remount failed (EACCES/EPERM/EINVAL), the path was left read-write and the closure proceeded topivot_rootandexec: the jail's effective authority exceeded the caveat. Now the return code is captured and the closurereturn Errs on failure.Test plan
ro_remount_failure_fails_closed(linux tier,#[ignore]d like the other jaild E2E proofs): a test-only fault seam (FAULT_RO_REMOUNT) forces the RO remount to fail, and assertsrun_jailedthen fails closed rather than exec'ing (baseline with no fault still runs). Reverting thereturn Errre-fails it.clippy -D warningsclean,cargo fmtclean, the 14 non-ignored jaild tests pass; full pre-push gate[pre-push] OK.Scope
Contained to
linux.rs. Minimal fail-closed change matching the closure's established errno-pipe pattern. (The related "failed initial bind is skipped" nuance from the issue is benign for RO mounts — a bind that fails leaves the path absent, which is fail-safe; the writable-path breach is the remount, which this closes.)Fixes #266
🤖 Generated with Claude Code