Skip to content

fix: harden Linux namespace supervisor memory - #243

Merged
kevin-orellana merged 9 commits into
mainfrom
feature/linux-supervisor-memory-isolation
Nov 2, 2026
Merged

kevin-orellana merged 9 commits into
mainfrom
feature/linux-supervisor-memory-isolation

Conversation

@kevin-orellana

@kevin-orellana kevin-orellana commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Human readable section

Problem. On some Linux hosts, a workload inside Box could open a file exposing the memory of the Box process that manages it. This process is the namespace reaper, which collects child exit statuses. The file, /proc/1/mem, identifies its memory from inside the workload's process environment. Access depended on the host allowing memory inspection between processes owned by the same user.

Solution. Before starting the workload, Box applies a Linux setting that restricts access to the reaper's memory. If setup fails, Box reports failure and does not start the workload. The regression test checks that the workload cannot open /proc/1/mem.

Trade-off. This change protects the reported memory-access route and keeps the existing namespace reaper design. It does not add restrictions on which system calls the reaper can make.

Description

The namespace reaper has process ID 1 inside the workload's process namespace, which gives processes their own view of process IDs. It collects the exit status of child processes.

Before starting the workload, the reaper closes unnecessary file descriptors, which are handles for open files and communication channels. It then sets PR_SET_DUMPABLE=0, the Linux setting used here to restrict memory inspection. Box reports successful setup only after both steps succeed. If either step fails, process ID 1 exits without starting the workload.

The reaper must retain the pipe writer used to report setup status until it sends that status. It sends the success byte and closes the writer before creating the workload process. A regression test uses a real setup-status pipe and checks that the workload does not inherit its writer.

The Linux probe requires a read-only open of reaper memory to fail with EACCES, meaning permission denied. It separately attempts a read-write open. That open must fail with either permission denial or EROFS, meaning a read-only filesystem. This lets the test work with the read-only process filesystem in PR #241 without treating that mount alone as reaper isolation.

For a non-root launcher, the probe also checks that reaper memory no longer has the workload's owner. This prevents Yama, a Linux restriction on process tracing, from hiding a missing reaper protection. The harness passes the original host user identity because both processes map to user ID zero inside containment. Root launches still require read denial, but ownership can remain unchanged. For root, the harness first verifies host ptrace_scope=0; otherwise it prints a skip. A separate test checks that decision for permissive, restrictive, empty, and unavailable settings.

The test stages its executable under the launch identity and runs on supported ARM64 Linux. It retains a successful self-memory read as its permitted control. Two additional tests exercise failure to apply the PR_SET_DUMPABLE setting.

These checks cover the reported reaper-memory route. The change does not add a seccomp filter, which restricts the system calls a process can make, to the reaper.

The design guide now explains the reaper memory guard, startup refusal, and its distinction from a read-only process filesystem. It also states that the reaper remains outside the workload's seccomp filters.

Related Issues

Related to the Linux supervisor-isolation security finding. No public GitHub issue.

Type of Change

  • Bug fix
  • Documentation update

Testing

Merge follow-up at 030d7291763361a1d3ebc9be2797097e72c8c2fa. PR #241 has merged into main. This follow-up merges that revision and retains both memory-protection explanations in the design guide. The production reaper code is unchanged from the human-approved 30ae3cd.

The old PR #241 unit test inherited the reaper's memory-inspection setting before executable launch. Its permitted self-memory read then failed with exit code 64. The test now runs after executable launch, as the saved integration candidate already did. It retains all seven denied access routes and the successful self-read, direct-write, and writable-mapping controls. The supervisor test alone retains the root Yama prerequisite. No PR #248 setup-writer change is included.

Validation on native ARM64 Amazon Linux 2023, Rust 1.98.1, with EXPERIMENTAL_LINUX_SUPPORT=TRUE:

  • The complete workspace suite passed with all features and no fail-fast. Its 141 standard Rust test targets reported 4,575 passes, zero failures, and 17 declared ignored tests. The separate custom library harness also exited successfully. Three runtime skip messages remain separate: the unavailable socket-alias fixture, the declared alias-read limitation, and the absent credential daemon.
  • Formatting, repository-configured workspace Clippy, the Box and containment build, and git diff --check passed.
  • All three focused memory tests passed as both ordinary user and root, with verified host Yama zero and no skips.
  • The deterministic integration suite passed 124 cases, with nine declared macOS-only skips. All 133 expected cases were recorded. The receipt retains hashes of the five tested binaries because its commit field was unavailable.
  • The examples build passed. No scripted examples exist, and the manual SDK tutorial was not run.
  • Independent review found no actionable defects. The seven-route probe matches the previously mutation-tested integration source byte for byte. An uncontained negative control failed because it could write an executable page.

The tested source tree matches this commit. The CI Gate at 030d729 passed, including Linux and macOS workspace and deterministic suites. The hosted Linux memory target reported three passes, zero failures, and no skips. All CodeQL language analyses passed. The automated review at 030d729 assessed this revision as Approve with no new findings. All four review discussions are resolved. That reviewer could not execute namespace tests on its host; the runtime evidence above remains separate.

GitHub dismissed the earlier human approval when this merge follow-up was pushed. Renewed human approval remains required. Protected auto-merge remains enabled.

Documentation follow-up at 30ae3cdaea56c3141370dfdcd2c67a7ec4b11079. This follow-up adds the design explanation only. No Rust source, manifests, or tests changed from 9fb885705da278c6eb65e89557c49e5e57a35132. Source inspection, the repository prose checker, git diff --check, and all 13 relative links and anchors passed. Runtime suites were not repeated locally for this documentation delta. GitHub reruns the runtime suites selected from the complete PR diff. Independent source and prose review passed. The guide uses the defined namespace reaper terminology and keeps test names in review evidence. The automated review at 30ae3cd assessed this head as Approve with no new findings. The CI Gate at 30ae3cd passed, including Linux and macOS workspace and deterministic suites. All CodeQL language analysis jobs also passed at this head. These results do not establish complete coverage or formal maintainer approval.

The automated review at d0027f6 approved the behavior explanation with one nonblocking terminology comment. 30ae3cd corrects that wording. The supporting regressions are workload_cannot_write_namespace_supervisor_memory and a_reaper_that_remains_dumpable_terminates_its_namespace; the guide omits their names under its writing rules.

Previous test-only follow-up: 9fb885705da278c6eb65e89557c49e5e57a35132. The follow-up changes only the regression tests and their documentation. Independent source review found no remaining issues. The complete local workspace suite passed: 4,587 passed, zero failed, and 17 declared ignored tests. The hosted checks at 9fb8857 passed, including Linux and macOS workspace and deterministic suites. Human approval remains required.

All hosted checks at the previous head b50a5ce passed. That result does not attest later revisions.

Test evidence at 9fb8857

On native ARM64 Amazon Linux 2023, Rust 1.98.1, with EXPERIMENTAL_LINUX_SUPPORT=TRUE and host kernel.yama.ptrace_scope=0:

  • cargo test --workspace --all-features --no-fail-fast -- --nocapture passed.
  • cargo fmt --all --check, repository-configured workspace Clippy, the Box and containment build, and git diff --check passed.
  • The supervisor-memory regression passed under both ordinary-user and root launches.
  • The root-prerequisite regression passed. The real root memory run executed under verified Yama zero; it did not skip.
  • The supervisor probe also passed through the complete strands-box run command.
  • Bare strict Clippy ran and reported six existing diagnostics in unchanged bundled shell code. The required recipe passed with the allowances listed below.
  • Four runtime skip-message lines remain separate from the 17 declared ignored tests. These results do not establish execution of silent host-dependent early returns or complete coverage.

Integration with PR #241 and PR #248

I tested a combined candidate using PR #241 at c5641a0, PR #248 at d806fc2, and the supervisor changes through b50a5ce. The final 9fb8857 follow-up changes only root test prerequisites and documentation, not production code. The combined candidate's measured root runs already used verified Yama zero. Its merge resolution keeps the workload setup writer until executable launch, as PR #248 requires. Do not restore this standalone branch's early writer closure when combining them.

Retain the final root prerequisite in the combined supervisor test without skipping the separate executable-memory test.

The PR #241 process-memory test needed to run after executable launch, rather than inherit the supervisor's non-dumpable state. The tested integration resolution moves all seven access routes into the executed probe and retains successful memory-access controls. The merge follow-up now includes that test migration. PR #248's separate setup-writer change remains outside this PR.

Both memory probes passed as ordinary user, root, and through the full Box command. Deliberately removing each memory safeguard failed its corresponding test. Closing the setup writer early failed 10 of 12 setup tests. All faults were restored before final validation. The deterministic containment suite passed 124 cases, with nine declared macOS-only skips.

Complete integration rerun: The complete combined workspace suite passed with 4,616 passes, zero failures, and 17 declared ignored tests. It used the original command and four-test-thread setting, unchanged source, and unchanged test binaries. The previously failing policy-latency test passed. Four runtime skip-message lines remain separate from declared ignored tests. The run took 1,141 seconds.

Historical limitation: The earlier combined workspace run had 4,615 passes, one policy-latency failure, and 17 declared ignored tests. Its affected target passed all 18 tests in both focused retries. The complete rerun above now supplies a clean full-suite result. The earlier failure's cause remains unestablished; no threshold or policy code changed, and that failed run remains preserved.

Cargo rebuilt product executables during the complete rerun. Both product-executable sets are preserved, and the earlier set was restored for the frozen deterministic and full-command evidence. The rerun does not claim new deterministic or full-command coverage of its rebuilt product executables.

Previous hosted checks at be5ab39. GitHub's CI Gate passed. This continuous integration result is historical. It does not establish complete test coverage or human approval.

Local test evidence

How have you tested the change? Verify that the changes do not break functionality or introduce new warnings.

The earlier workspace checks below identify revision be5ab39. They remain historical evidence. Other runs retain their original timing labels. The Linux development desktop is identified as dd.

  • I ran the relevant suites (just check, or cargo test --workspace --all-features)
    • At 9fb8857, the complete workspace suite passed with all features and no fail-fast. The tested source hashes match the committed tree.
    • The dd host did not have just, so I ran the Rust gate steps directly from the PR-head worktree.
    • dd Linux passed cargo fmt --all --check at be5ab39 with Rust 1.98.1.
    • dd Linux passed repo-equivalent cargo clippy --workspace --all-targets --all-features -- -D warnings with the repo vendored-lint allowances at be5ab39 with Rust 1.98.1.
    • dd Linux passed EXPERIMENTAL_LINUX_SUPPORT=TRUE cargo test --workspace --all-features at be5ab39 with Rust 1.98.1.
    • cargo test -p strands-box-containment --all-features passed on macOS before the review follow-up.
    • Docker Linux passed cargo test -p strands-box-containment --all-features --test supervisor_memory_linux -- --nocapture before the review follow-up.
    • Docker Linux passed cargo test -p strands-box-containment --all-features failed_non_dumpable_refuses_launch -- --nocapture before the review follow-up.
    • Docker Linux passed cargo test -p strands-box-containment --all-features a_reaper_that_remains_dumpable_terminates_its_namespace -- --nocapture before the review follow-up.
    • cargo check -p strands-box-containment --all-features --target aarch64-unknown-linux-gnu --lib --bins passed locally before the review follow-up.
    • dd Linux passed cargo test -p strands-box-containment --all-features --test supervisor_memory_linux -- --nocapture after the first review follow-up.
    • dd Linux passed cargo test -p strands-box-containment --all-features failed_non_dumpable_refuses_launch -- --nocapture after the first review follow-up.
    • dd Linux passed cargo test -p strands-box-containment --all-features a_reaper_that_remains_dumpable_terminates_its_namespace -- --nocapture after the first review follow-up.
    • dd Linux passed cargo test -p strands-box-containment --all-features the_reaper_closes_the_exec_confirm_writer_before_the_workload_runs -- --nocapture after the setup-status fix.
    • dd Linux passed cargo test -p strands-box-containment --all-features the_reaper_writes_the_exec_confirm_byte_and_a_failure_byte -- --nocapture after the setup-status fix.
    • dd Linux passed cargo test -p strands-box-containment --all-features --test supervisor_memory_linux -- --nocapture after the setup-status fix.
    • dd Linux passed cargo test -p strands-box-containment --all-features failed_non_dumpable_refuses_launch -- --nocapture after the setup-status fix.
    • dd Linux passed cargo test -p strands-box-containment --all-features a_reaper_that_remains_dumpable_terminates_its_namespace -- --nocapture after the setup-status fix.
    • dd Linux passed cargo test -p strands-box-containment --all-features after the setup-status fix.
  • If I touched Rust, I ran cargo fmt --all and cargo clippy --workspace --all-targets --all-features -- -D warnings
    • Both ran for 9fb8857. Formatting and configured Clippy passed. Bare strict Clippy still reports the same six existing bundled-shell diagnostics.
    • Both commands ran on dd Linux at be5ab39 with Rust 1.98.1. Formatting passed without source changes.
    • Bare strict Clippy failed on six existing diagnostics in unchanged crates/shell code. This checkbox records execution, not a bare strict-Clippy pass.
    • The required workspace lint gate passed with the exact allowances from just clippy. CONTRIBUTING.md requires those allowances for bundled shell code.
    • The allowances were clippy::too_many_arguments, clippy::only_used_in_recursion, clippy::await_holding_refcell_ref, clippy::explicit_auto_deref, clippy::chunks_exact_to_as_chunks, dead_code, and non_snake_case.
  • git diff --check passed.

Review evidence and limits

  • The automated review at 9fb8857 assessed 9fb8857 as Approve with no new findings. All three review conversations are resolved. This assessment is not human approval.

  • The hosted review at b50a5ce approved it with one nonblocking root-prerequisite concern. 9fb8857 fixes that concern and updates the guard documentation.

  • Independent source review rechecked the final three-file correction and found no remaining issues. The owner ran the complete workspace suite and ordinary-user, root, and full-command checks.

  • The previous automated adversarial review assessed be5ab39 as Approve. The reviewer removed each status-writer safeguard and confirmed that the regression tests failed.

  • The automated reviewer confirmed the earlier setup-status blocker was fixed. Its separate host-network test failure persisted with the memory fix disabled.

  • The standalone full workspace suite passed on dd at both documented revisions. The combined candidate's complete rerun also passed; the earlier timing failure remains preserved as stated above.

  • GitHub's required CI Gate passed at test-only head 9fb8857, as linked above. Automated assessment does not replace required human approval.

Checklist

  • I have read the CONTRIBUTING document
  • I reviewed every line in this PR, including any generated by AI tools, and I can explain why it works
  • I kept this change focused and small. I split unrelated work into separate PRs
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • My changes generate no new warnings

Codex added and reviewed the documentation explanation at Kevin's request. The existing runtime evidence retains its original revisions and limits. Formal maintainer approval remains required.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

## Problem

The Linux namespace workload could open namespace PID 1 memory through procfs when host tracing policy was permissive. That kept the supervisor reachable from the contained workload.

## Solution

Namespace PID 1 now sets `PR_SET_DUMPABLE` to `0` before it forks the workload. If the kernel refuses that lock, PID 1 exits before it starts the workload.

The Linux probe binary now has a supervisor-memory check, and a new trampoline integration test proves the workload receives `EACCES` for `/proc/1/mem`.

## Tests

- `cargo test -p strands-box-containment --all-features`
- `cargo fmt -p strands-box-containment --check`
- `cargo clippy -p strands-box-containment --all-targets --all-features`
- `cargo check -p strands-box-containment --all-features --target aarch64-unknown-linux-gnu --lib --bins`
- Docker Linux: `cargo test -p strands-box-containment --all-features --test supervisor_memory_linux -- --nocapture`
- Docker Linux: `cargo test -p strands-box-containment --all-features failed_non_dumpable_refuses_launch -- --nocapture`
- Docker Linux: `cargo test -p strands-box-containment --all-features a_reaper_that_remains_dumpable_terminates_its_namespace -- --nocapture`
- Docker Linux: `cargo clippy -p strands-box-containment --all-targets --all-features`
- `git diff --check`

Baseline evidence from the remote Linux run showed the workload opened `/proc/1/mem`. The patched Docker Linux run returned `SUPERVISOR_MEMORY_DENIED`.
@kevin-orellana kevin-orellana changed the title Harden Linux namespace supervisor memory fix: Harden Linux namespace supervisor memory Oct 30, 2026
@kevin-orellana
kevin-orellana enabled auto-merge (squash) October 30, 2026 18:45
@github-actions github-actions Bot added Area - Agent Containment bug Something isn't working labels Oct 30, 2026
@kevin-orellana kevin-orellana changed the title fix: Harden Linux namespace supervisor memory fix: harden Linux namespace supervisor memory Oct 30, 2026
@github-actions

Copy link
Copy Markdown

Assessment: Comment

This review covers head ad38ad5. The fix closes the reported path. On a Yama ptrace_scope=0 host, PID 1 memory opens without the fix and returns EACCES with it. I reproduced this with a C model of the same launcher order. The main gap is the end-to-end proof: on Yama ≥ 1 hosts it passes whether or not the fix is present.

Review Categories
  • Testing: The /proc/1/mem probe proves the fix only on hosts with ptrace_scope=0. The failure_tests unit test does catch the fix being removed: I reverted the mod.rs hunk and a_reaper_that_remains_dumpable_terminates_its_namespace failed.
  • Behaviour scope: The workload's dumpability before exec, and the order of the failure report relative to EXEC_CONFIRM_BYTE, are side effects that are not documented.

Checked and held:

  • ptrace, process_vm_* and /proc/1/{root,fd,environ} share the same ptrace_may_access gate, so all of them are closed.
  • PID 1's mm->user_ns is the outer namespace, so the workload's capabilities inside the box namespace cannot bypass the gate.
  • PID 1's capset after the fork only removes capabilities, so it does not reset dumpability.
  • The flag is set before the workload fork, so no window exists.
  • No frozen surface or pub use set changes. The new helper is pub(crate).

@kevin-orellana

Copy link
Copy Markdown
Collaborator Author

Automated review follow-up is in 5d40070.

  • For the setup-status comment: descriptor cleanup and PR_SET_DUMPABLE refusal now run before EXEC_CONFIRM_BYTE. If either step fails, PID 1 writes APPLY_FAILURE_BYTE before it exits.
  • For the Yama-dependent test comment: the Linux probe now stats /proc/1/mem before opening it and fails if PID 1 memory remains owned by the workload uid. It then still requires the open to return EACCES.

Focused dd Linux validation after the follow-up passed: supervisor_memory_linux, failed_non_dumpable_refuses_launch, a_reaper_that_remains_dumpable_terminates_its_namespace, and cargo clippy -p strands-box-containment --all-targets --all-features.

@github-actions

Copy link
Copy Markdown

Assessment: Request Changes

This review covers head 5d40070, compared with ad38ad5. The Yama-independent check in the probe is correct. The new reorder in the reaper breaks the setup-status protocol: PID 1 closes the status writer before it writes to it. Details and a test that shows it are in the reply on the mod.rs thread. This blocks the merge, because contained stdio MCP servers would hang at startup.

Review Categories
  • Correctness: Every status byte after the descriptor sweep now goes to a closed descriptor, both the success byte and the failure bytes.
  • Testing: Every reaper test passes confirm_fd = None. The status-pipe path between the reaper and the supervisor has no test, so the focused runs could not catch this.

Checked and held:

  • The stat("/proc/1/mem") owner check tells dumpable from non-dumpable on every Yama setting: overflow uid 65534 when non-dumpable, the workload's own uid when dumpable.
  • PR_SET_DUMPABLE still runs before the workload fork.
  • PID 1 can still read /proc/self/fd after it becomes non-dumpable, so the reorder does not break the sweep.

@kevin-orellana

Copy link
Copy Markdown
Collaborator Author

Automated review follow-up for the setup-status blocker is in be5ab39.

  • PID 1 now adds confirm_fd to the descriptor-sweep keep list, so cleanup no longer closes the setup-status writer before the status byte.
  • After refuse_process_memory_access() succeeds, PID 1 writes EXEC_CONFIRM_BYTE and then closes the setup-status writer before it forks the workload.
  • The new regression test the_reaper_closes_the_exec_confirm_writer_before_the_workload_runs passes a real setup-status pipe, verifies that the reader receives 0, and verifies that the workload sees EBADF for that writer descriptor.

dd Linux validation at be5ab39 passed:

  • cargo test -p strands-box-containment --all-features the_reaper_closes_the_exec_confirm_writer_before_the_workload_runs -- --nocapture
  • cargo test -p strands-box-containment --all-features the_reaper_writes_the_exec_confirm_byte_and_a_failure_byte -- --nocapture
  • cargo test -p strands-box-containment --all-features --test supervisor_memory_linux -- --nocapture
  • cargo test -p strands-box-containment --all-features failed_non_dumpable_refuses_launch -- --nocapture
  • cargo test -p strands-box-containment --all-features a_reaper_that_remains_dumpable_terminates_its_namespace -- --nocapture
  • cargo clippy -p strands-box-containment --all-targets --all-features
  • cargo test -p strands-box-containment --all-features

@github-actions

Copy link
Copy Markdown

Assessment: Approve

This review covers head be5ab39, compared with 5d40070. The status-writer blocker is fixed. PID 1 now keeps the writer through the descriptor sweep, writes the result byte, and closes the writer before it forks the workload.

A correction to my last review: I wrote that every reaper test passes confirm_fd = None. That was wrong. the_reaper_writes_the_exec_confirm_byte_and_a_failure_byte already passed a real pipe, and it would have caught the regression in 5d40070.

Checked and held:

  • I removed sweep_keep.push(fd), and both the_reaper_* tests failed (view built: wrong status bytes, [] vs [0]). The fix is pinned.
  • I removed close_confirm_writer(confirm_fd), and the new test failed with exit 70. The rule that the workload does not inherit the writer is pinned, as it was at base.
  • The APPLY_FAILURE_BYTE writes after the sweep (the sweep error and the PR_SET_DUMPABLE refusal) now go to a live descriptor.
  • The streaming leaf's setup_failure() read now gets 0 before the workload starts, so it does not block.
  • At be5ab39, cargo test -p strands-box-containment --all-features passes 393 of 394 tests here. The one failure is allow_all_joins_the_host_network_and_keeps_the_other_namespaces (41, host loopback unreachable). It fails the same way with refuse_process_memory_access stubbed out, so it comes from this host's network, not from this PR.

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

Assessment: Approve (one non-blocking comment)

This review covers head b50a5ce, compared with be5ab39. Only the test and the AGENTS.md note changed. The new root-launcher exemption in the probe fixes a false failure, but it lets the guard pass vacuously for root runs when Yama is ≥ 1. The reproduction table is in the inline comment on test_probe.rs.

Checked and held:

  • The target_arch = "aarch64" gate matches the facade's aarch64-only Linux mechanism, so no x86_64 coverage is lost. On x86_64 the trampoline refuses to launch, as containment-deterministic.yml documents.
  • For a non-root launcher, the owner check still separates the two cases: 65534 when PID 1 is non-dumpable, 0 when it is dumpable. I reproduced both with Yama 0 and Yama 1.
  • rust-test-lint.yml runs this test as the non-root runner user, so the CI guard still discriminates.
  • The read-only open runs before the write attempt, so accepting EROFS on the write cannot hide a readable /proc/1/mem.
  • The AGENTS.md guard note matches the new owner behavior for non-root and root launchers.
  • The reaper and status-pipe code are unchanged since be5ab39.

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

Assessment: Approve

This review covers head 9fb8857, compared with b50a5ce. The root-launcher gap from my last review is closed. The guard now skips, with a printed reason, unless the launcher is non-root or the host has verified kernel.yama.ptrace_scope=0. The probe comment and the AGENTS.md guard note now state the same condition.

Checked and held:

  • Every case that reaches the new gate behaves as intended:
    • A non-root launcher always runs, and the owner check decides the result.
    • Root with Yama 0 runs. My earlier reproduction shows a dumpable PID 1 opens /proc/1/mem there, so the probe fails on the regression.
    • Root with Yama 1, 2, or 3 skips.
    • Root with the Yama file missing or empty skips. This is conservative, and nothing can pass falsely.
    • Root inside a container reads the host's ptrace_scope, because /proc/sys/kernel/yama comes from the host kernel.
  • launcher_uid is read once, before the trampoline runs, and the same value is passed to the probe, so the test and the probe use one uid.
  • root_memory_proof_requires_a_verified_permissive_host covers the whole predicate table, including "0\n", "", and None.
  • With the aarch64 gate temporarily removed, --test supervisor_memory_linux compiles and both tests pass on this x86_64 host. The gate is restored.
  • The reaper, the status pipe, and PR_SET_DUMPABLE code are unchanged since be5ab39.

Comment thread docs/design/linux-enforcement.md Resolved
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

Assessment: Approve (one non-blocking comment)

This review covers head d0027f6, compared with 9fb8857. Only docs/design/linux-enforcement.md changed, with a new paragraph about the namespace PID 1 memory guard. Its claims about behavior match the code. The one inline comment is about a defined term that the paragraph uses with a second meaning.

Checked and held:

  • PR_SET_DUMPABLE=0 is set before the workload fork: refuse_process_memory_access runs before the EXEC_CONFIRM_BYTE write and the fork in establish_pid_namespace_and_reaper.
  • When that call fails, the reaper writes APPLY_FAILURE_BYTE and calls _exit(127) as PID 1, so the namespace ends before any workload starts.
  • Only the workload installs seccomp: install_syscall_filters runs in apply after establish_pid_namespace_and_reaper returns, and only the workload process returns Ok. The reaper exits through _exit and does not reach that call.
  • Both cited tests exist with the names given: workload_cannot_write_namespace_supervisor_memory (tests/supervisor_memory_linux.rs) and a_reaper_that_remains_dumpable_terminates_its_namespace (namespace/failure_tests.rs).
  • The statement that a read-only /proc does not stop reads matches the probe's order: the read-only open runs before the write attempt.
  • Root rule 3 holds: the paragraph names symbols and tests, and it cites no file.rs:LINE.
  • There is no code change since 9fb8857, so the gate, reaper, and status-pipe findings from the previous review still apply.

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

Assessment: Approve

This review covers head 30ae3cd, compared with d0027f6. Only docs/design/linux-enforcement.md changed, and the change resolves my terminology comment. I have no new findings.

Checked and held:

  • The page now calls namespace PID 1 "the namespace reaper", which matches the code ("namespace reaper") and crates/containment/AGENTS.md. It no longer uses "supervisor", which terminology.md defines as the host-side role, so root AGENTS.md rule 5 holds. terminology.md has no entry for "reaper", so the word has no conflicting meaning.
  • The line that named the two tests was removed. The page now makes no claim about tests, and its behavior claims (non-dumpable before the workload fork, setup failure and namespace exit when that fails, seccomp only in the workload) still match establish_pid_namespace_and_reaper and apply.
  • There is no Rust change since 9fb8857, so the gate, reaper, and status-pipe results from the earlier reviews still apply.

pgrayy
pgrayy previously approved these changes Nov 2, 2026
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

Assessment: Approve

This review covers head 030d729, a merge of 30ae3cd with main at b25725d (#241). Compared with main, the PR now has one new part: #241's proc_mem_cannot_write_executable_memory moved out of the in-process unit test in namespace/mod.rs. It is now an end-to-end test in tests/supervisor_memory_linux.rs, which runs a new --attempt-executable-memory-write mode of the probe through the real trampoline. I have no new findings.

Checked and held:

  • The merge kept fix: block proc mem executable page writes #241's protection. view.rs (the /proc mount is writable: false) and the /proc paragraph that fix: block proc mem executable page writes #241 added to linux-enforcement.md match main exactly. The only reaper change compared with main is this PR's own code, which my earlier reviews covered.
  • The moved test checks every route the old one did: /proc/self/mem, /proc/thread-self/mem, /proc/self/root/proc/self/mem, /proc/<pid>/mem, /proc/self/task/<tid>/mem, the reopened /proc/self/fd/N, and a forked child. It also keeps the checks that direct memory writes and a writable mapping still work.
  • The moved test is stricter than the old one:
    • It first proves that /proc/self/mem can be read. Before, an open that failed for any other reason counted as denied.
    • It accepts only EROFS. Any other open error, or any handle that opens for writing, now fails the test.
  • The move did not reduce CI coverage:
    • The file's aarch64 gate matches the repository rule that Linux containment needs ARM64 (child_ipc.rs and loader_dependencies_linux.rs use the same rule).
    • The Linux unit-test job runs on ubuntu-24.04-arm.
    • No workflow or doc refers to the test by its old namespace::tests:: path.
  • The probe's executable-memory mode ignores the uid argument that run_memory_probe passes to it, so sharing one launcher between the two modes is harmless.

I could not run these tests on this host. Unprivileged user namespaces are blocked here (uid_map write fails with EPERM), so with the arch gate removed both cases print the "cannot build a namespace mount view" skip. The ubuntu-24.04-arm CI leg is where this test actually runs.

@kevin-orellana
kevin-orellana merged commit 0247b23 into main Nov 2, 2026
23 of 24 checks passed
@kevin-orellana
kevin-orellana deleted the feature/linux-supervisor-memory-isolation branch November 2, 2026 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area - Agent Containment bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants