Repository navigation
Conversation
## Problem Linux containment refused every architecture except aarch64 (strands-agents#21), so Box could not run on x86_64 hosts such as Kata pods on EC2 m7i. Removing the gate alone is not sufficient: x86_64 programs, the dynamic loader, and CPython still call the legacy syscall spellings that the ARM64 table removed, and the permit filter answers each of them with EPERM. ## Solution - The facade selects the namespace launcher on aarch64 and x86_64. It refuses every other Linux architecture by name, and the refusal now names both. - On x86_64 the permit filter also allows 28 legacy spellings. Each one is permitted only because its modern twin is already a shared permit, and no spelling reaches more than its twin does. arch_prctl is the one exception: glibc needs it at startup, and every subcommand changes only the calling process. - The restrictions filter does not change: x86_64 has no legacy spelling of a mediated call. modify_ldt, iopl, ioperm, and uselib stay refused. An x32 call gets EPERM from the default-deny permit filter, and an i386 call kills the process at the seccompiler arch check. - On aarch64 the compiled filters do not change. - CI gets an advisory ubuntu-latest containment leg, the same as the arm64 leg. ## Tests - syscall.rs: the twin rule, the single exception, the closed x86_64 calls, number collisions, the x32 bit, and the counts per architecture. - x86_64_syscall_surface_linux: at the kernel, the box refuses modify_ldt, iopl, ioperm, uselib, and x32 open with EPERM, where an uncontained control does not, and a legacy open(2) of a granted file succeeds. - facade.rs: x86_64 selects the launcher, and riscv64 is refused by name. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
Hi maintainers, could someone approve the pending workflow runs on this PR? As an outside contributor, CI and the PR-title check are at |
|
Status update, now that #21 has been folded into #45. #398 (merged Nov 11) landed Linux x86-64 on What this branch still has that
I am happy to close this, or to send the kernel-surface test as a small standalone PR against |
Description
Foundational-premise change. This changes why the box is safe on a new architecture, so it needs a maintainer's explicit call.
Linux containment refuses every architecture except aarch64 (
crates/containment/src/facade.rs). Many Kubernetes and VM-sandbox fleets are x86_64, for example Kata on EC2m7i. Lifting the gate alone is not enough. The permit filter is default-EPERM, and x86_64 programs (glibc, the dynamic loader, CPython) still call legacy syscall spellings that ARM64's generic table dropped. With only the gate removed, CPython fails at load (libpython3.12.so.1.0: cannot open).This change lets x86_64 select the namespace launcher, and it adds an x86_64-only permit table,
ARCH_PERMITTED, behind#[cfg(target_arch = "x86_64")].Load-bearing decisions:
WORKLOAD_PERMITTEDtable and is not mediated, so no spelling reaches more than its twin does. Each entry carriesArchBasis::Twin("<twin>"), and a unit test enforces the rule. The set is complete under the rule, not bisected to an observed minimum, because an unlisted call answersEPERMand callers read that as a real failure. The table has 28 twinned spellings: the issue's 27, plusutime.arch_prctlis the one exception, permitted without argument scoping. glibc needs it for thread-local storage (ARCH_SET_FS) and, on newer releases, for shadow stacks. PyTorch and oneDNN needARCH_REQ_XCOMP_PERMfor AMX on Sapphire Rapids. Every subcommand affects only the calling process. None reaches a path, a socket, another process, a filter, or a namespace. Docker's default profile also permits it unrestricted. Scoping it to a subcommand list would break AMX and CET startup, and it would have to track new kernel subcommands.modify_ldt,iopl,ioperm, anduselibare absent from the permit table. An x32 call (nr | 0x4000_0000, which sharesAUDIT_ARCH_X86_64) matches no permit key and getsEPERM, and a test pins that no permit key carries the x32 bit. An i386int 0x80call fails seccompiler's arch check, which kills the process.Observable changes. x86_64 Linux is now accepted. The refusal for any other Linux architecture now reads
Linux containment supports ARM64 (aarch64) and x86_64, not {architecture}. There is no change to thestrands-boxpublic API,box.toml, the CLI, or any record or protocol version.CI.
containment-deterministic.ymlgets an advisoryubuntu-latestleg, matching the advisory arm64 leg. That leg also runs a new kernel test, and the step fails if that test skips. Making Linux blocking stays the maintainers' call.Out of scope: an x86_64 Linux release tarball (
deploy-box-artifact.yml), and every Linux architecture other than aarch64 and x86_64.Related Issues
Related: #45 (tracker; #21 was consolidated into it)
Related: #10, #18
Type of Change
New feature
Testing
The first commit message names the test for each claim.
ubuntu-latest, x86_64, blocking): 0 failures. The 7 newsyscall.rstests (twin rule, single exception, closed calls, mediated collisions, the x32 bit, the per-arch counts, and the merged duplicate check) and the 2 newfacade.rstests ran and passed.x86_64_syscall_surface_linux(new), in the Deterministicubuntu-latestleg: passed, with no skip. At the kernel, the box refusesmodify_ldt,iopl,ioperm,uselib, and x32openwithEPERM, where an uncontained control run of the same probe does not. A legacyopen(2)of a granted file succeeds.iopl(run) fails it with'iopl' was not refused inside the box, and failsthe_x86_64_kernel_programming_calls_stay_closed. The leg is advisory, so this test does not gate a merge by itself; the unit tests in the blocking leg do.cargo test -p strands-box-containment -p strands-box --all-features, 0 failures.strands-box-containmentall pass. The aarch64 count is still 114.cargo fmt --all -- --checkis clean.cargo clippy --workspace --all-targets --all-featuresgives no warnings in the files this PR touches. The warnings it does give are onmainalready (chunks_exact_to_as_chunksincontain_trampoline/args.rsandnamespace/view.rs, and several incrates/shell). I did not run it with-D warnings.m7i, the issue's environment.Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
🤖 Generated with Claude Code