Repository navigation
feat(box): add experimental Linux x86-64 support - #398
Conversation
## Problem Box rejects Linux x86-64 before workload startup. Removing that check alone leaves runtime calls blocked by the system-call filter. ## Solution Select the existing Linux namespace backend on x86-64. Add x86-only permissions for epoll_wait, dup2, poll, readlink, and getpgrp. Permit arch_prctl only for ARCH_SET_FS, matching the command's lower 32 bits. Test permitted thread setup, denied commands, architecture selection, and the expected permit counts. Correct the architecture-selection docs. This implements part of #45. Broader x86 qualification and release work remain outside this draft. ## Tests Builds with all features and without default features pass. Formatting, workspace Clippy with the repository's allowances, the focused thread setup test, and the native x86 smoke checks pass. Six isolated behavior changes were detected at their intended test assertions. The full script suite reports one failure: the deferred x86 rename gap. The deterministic gate is red: 108 passes, 22 failures, one error, and 10 declared platform skips. The PR records the coverage limits.
|
Assessment: Request Changes The architecture switch and the scoped Checks that held
The PR description is thorough about the x86 gaps that remain, and that helped this review. |
## Problem Native Git on x86 fails when the filter rejects access on its configuration paths, although the equivalent faccessat operation is already permitted. ## Solution Permit access only on x86 and test existing and absent paths under the real filters. Document the measured call use and pinned thread-setup constants. Correct the architecture decision note and add the initial-startup diagram. ## Tests The new effect test fails before the permit and passes afterward. All 489 containment library tests pass. Native smoke, alternate-ABI probes, and the full Git identity permit/deny case pass with the repaired executable bundle. Owned-package Clippy passes without owned warnings. The strict workspace command still reports six existing diagnostics in unchanged vendored code. Broader native and hosted regression suites are being repeated separately.
|
Assessment: Approve I re-reviewed at Checks that held
Non-blocking follow-up for #45: on x86-64, glibc 2.39's |
|
Assessment: Request Changes I re-reviewed at Checks that held
Non-blocking: the description says the earlier legacy-alias guard suggestion "is implemented". What was added is the |
|
Assessment: Approve I re-reviewed at Checks that held
The non-blocking note from the previous summary still stands. No test makes sure that a later alias such as |
|
Assessment: Comment I re-reviewed at Checks that held
The non-blocking |
|
Assessment: Approve I re-reviewed at Checks that held
The non-blocking note still applies to the follow-up for #45: no test makes sure a future legacy call like |
Human readable section
Problem
Box rejects Linux x86-64 before starting a workload. Removing that architecture check alone does not make the tested programs work: Box also blocks system calls that their x86 builds use. Python cannot create a directory or rename a file, Bash cannot create a pipe, and the coding agents cannot complete startup or launch their shell.
Solution
Enable experimental Linux x86-64 support by setting the Box operator environment variable
EXPERIMENTAL_X86_SUPPORTto exactlyTRUE:Without that exact value, Box refuses command execution before reading configuration or starting a workload. The check covers
runandpolicy generate-schema, including their Rust library entry points. Help and version output remain available. ARM64 requires no opt-in, and the oldEXPERIMENTAL_LINUX_SUPPORTvariable remains inactive. The flag follows the former Linux startup opt-in; it does not change sandbox permissions.With the opt-in, Box selects the existing Linux sandbox on
x86_64and permits the x86 system-call entry points needed by these programs. The kernel already provides these operations. Box's permit list was missing the entries.access,stat,lstat,readlink,openmkdir,rename,unlink,rmdir,chmod,symlinkepoll_wait,poll,dup2,pipe,getpgrpvforkarch_prctl(ARCH_SET_FS); other commands remain deniedRetain the existing filesystem, network, and restricted-call rules. Reject requested set-user-ID and set-group-ID bits for x86
mkdirandchmod, using their second argument. Apply the existingopenatcreation checks toopen, whose flags and mode are its second and third arguments. An unused mode must not refuse a read. ARM64's permission policy is unchanged.The new tests check file contents and metadata, permitted writes, refusals for hidden and read-only paths, symbolic links pointing outside grants, and the
vforkchild’s inherited denial ofsetuid, even when it requests its unchanged user ID. Tests also distinguish ordinary modes from special permission bits and exercise ignored upper argument bits. The containment instructions record the observed workload calls and their existing Linux counterparts.Figure 1: Linux x86-64 execution requires the exact startup opt-in. Enabled workloads use the existing sandbox with the x86-only system-call permissions and argument restrictions shown below.
Editable diagram source.
Decisions the change depends on
The decision log retains ARM64 startup without opt-in and records the experimental x86 startup opt-in.
Trade-off and scope
This lets the tested coding agents complete bounded tasks on x86-64 and repairs the listed native file, pipe, and child-creation operations. The checks below retain a shared Linux timed-wait failure. Full application compatibility, installation, packaging, and release qualification remain in the x86 support tracker, owned by @kevin-orellana. The Box startup flag keeps x86-64 execution opt-in. The standalone containment library still selects its backend by platform and architecture.
The patch leaves shared Node, Python timed-wait, and parallel test-fixture failures outside its implementation scope. Claude's trace also showed a nonfatal
linkmaintenance failure. That call remains unpermitted, so this PR does not claim warning-free operation or complete CLI compatibility.Description
Add an explicit experimental startup opt-in for Linux x86-64. Enable its existing containment backend and the 18 x86-only permission entries above, including the three file-mode restrictions and the restricted thread-storage command.
Related Issues
Related to #45. This PR completes part of that tracker; it does not close it.
Type of Change
Testing
Experimental startup gate
Revision:
f78391bfae2b571c83396474030fa35de2e3a9c4. The native checks bind the changed source files to this revision. ARM uses a preserved checkout with the same verified source files; it is not claimed as a clean checkout of the new commit. The documentation-only follow-up at75c85772f33d22cc38870b0272b576fd4dcf4dd9changes the decision log; runtime source and binaries remain unchanged. Its 27 site-manifest tests pass.TRUEadmits startup. The old Linux variable alone cannot enable x86. Help and version output remain available. Refusal occurs before configuration reads, host callbacks, or hardening.TRUEand writes the expected file. The native outside control also passes. The operator flag is absent from the workload environment.fc61d27448acdac36ec3425748a2ed48afc922f5, combiningf78391bfwith mainline20aab41a; its tree differs from the native-test revision. None of the upstream changes overlap the flag's 13 changed files. Both deterministic runs recorded all 141 cases with zero failures or errors: ARM64 had 131 passes and 10 declared skips; macOS had 129 passes and 12 declared skips. Both full coverage gates passed with no quarantine or integrity problems.f78391bf. Each fresh analysis reports zero findings; the Rust analysis has no warning or error.75c85772f33d22cc38870b0272b576fd4dcf4dd9changes onlydocs/design/decisions.md. Native and completed flag-revision results above remain attributed to their tested revisions. CI run 43074457904 and CodeQL run 43074445405 passed. CI tested mergec160f2ab6b4458c5a8614a62606a5db8c8c54354, combining this commit with mainline20aab41a; only the decision-log blob differs from the earlier tested merge. Both workspace jobs, both deterministic jobs, lint, packaging, site validation, andCI Gatepassed. The deterministic results remain 131 passes/10 declared skips on ARM64 and 129 passes/12 declared skips on macOS, with all 141 cases recorded, zero failures or errors, full coverage gates, and no quarantine or integrity problems. All five fresh CodeQL analyses report zero findings, warnings, or errors.The ARM failures are
fallback_closes_inherited_and_broker_descriptorsandan_incompatible_frame_after_readiness_fails_without_fallback, both withText file busyatmcp_alias_fallback.rs:128. The fixture is byte-identical to the PR base and the earlier tested revisions. The pre-flag ARM campaign records the same error at the same location. This change leaves that fixture untouched. ARM Clippy also reports six existing vendored Shell diagnostics, and the build reports 68 existing containment warnings. All affected files are byte-identical to the PR base; no diagnostic points to the changed Box code.The updated diagram uses the pinned draw.io 32.4.1 container at scale 2 and border 20. The unchanged control render was byte-identical to the previous PNG. The edited figure passed the layout checks and was visually inspected.
Earlier compatibility campaign
The following results cover the compatibility revision before adding the startup flag. The coding-agent tasks were not rerun for the flag change; the new startup controls above cover that change separately.
Revision:
379c173ec02de570a727bf28267a9208b6925222. Base:8a5f9ba262a5260b269b25ac6a75bf74abcdc89c. Native tests use Amazon Linux 2023 with the glibc 2.34 C runtime library: x86 kernel6.12.113-138.209.amzn2023.x86_64and ARM kernel6.12.114-139.210.amzn2023.aarch64.rmdirbreaks cleanup. Complete-Box controls reproduced failures in native Pythonos.rmdir, Pythonshutil.rmtree, andgit clean -fdon x86; all outside and ARM controls succeeded. The same three workflows pass after the repair. The same final compiled regression fails before the repair and passes afterward, checking removal from writable scope and unchanged directories in read-only and hidden scopes.mkdir/chmodrestrictions, the wrong mode index for those calls, missingopenrestrictions, the wrongopenmode index, and checking unusedopenmodes. Correct source and executables were restored and the tests passed again. The cleanup follow-up does not change those mode rules or tests.rmdiraddition, native x86-64getpidsucceeds. The i386 call succeeds outside Box; its contained child receivesSIGSYSand is reaped. An x32-tagged call returnsENOSYSoutside andEPERMinside. This kernel cannot provide functional x32 application coverage. The cleanup change leaves the architecture guards unchanged.ENOENT, and the canary remained unchanged.calc.py, passed two unchanged native Python tests, ran Git diff, and exited normally, inside and outside Box on both architectures. Completed tool output and independent host retests verify the work; contained runs also record the exact native command arguments.Text file busyin the unchanged host alias fixture; all nine fixture tests passed serially. No fixture code changed, so this successful run does not establish a repair for that intermittent failure.Text file busyfailures, and 20 ignored tests before the final x86-only process-creation and cleanup additions. All nine fixture tests passed serially. That earlier full ARM workspace script remains failed.756126e2, whose source tree matches this revision. ARM64 and macOS unit and deterministic jobs, lint, packaging, andCI Gatesucceeded. Each deterministic run recorded all 141 expected cases with zero failures or errors: ARM64 had 131 passes and 10 skips; macOS had 129 passes and 12 skips. Both full coverage gates passed with no quarantine or integrity problems.Coverage limits
The native app checks use CPython 3.9.25, Bash 5.2.15, Git 2.50.1, Codex 0.167.0, and Claude Code 2.1.319. Each coding agent completes one bounded arithmetic-edit task with two unchanged native Python tests and a Git command. Codex's inner sandbox is disabled for these Box checks. Its interactive checks use
--no-daemon; Codex's default background-service path remains untested. Interactive coverage is one short coding task per app and configuration. The apps' tool-approval prompts were disabled; Box policy stayed active inside Box. These checks do not qualify long sessions, reconnects, or every interactive feature. No new filesystem boundary probes ran in these interactive tasks. Claude's separate boundary probe remains untested because its earlier outside control refused the request before running tools.The final x86 captured-subprocess case received the child's output and successful exit, but the parent failed during a timed wait. CPython uses
pselect6for its short sleep; Box's common permit table refuses that call. Standalonetime.sleep(0.001)probes reproduce the refusal on both architectures, with valid outside controls. A contemporaneous earlier-bundle subprocess control passed without entering that sleep path. The failed final case remains recorded; this PR does not change the shared wait policy.The separate
tempfile.TemporaryDirectorycleanup probe remains untested: both contained hosts failed to load thelibcrypto.so.3runtime dependency under that probe's profile. The observedos.rmdir,shutil.rmtree, and Git results above do not establishTemporaryDirectorybehavior.Some existing Linux integration tests still return early on x86 because their fixture requires ARM64. A passing workspace count does not qualify those paths. The separate Node probes fail on both hosts; no Node repair or general Node-application compatibility is claimed here. The host kernels differ by one patch version, so paired results do not isolate CPU architecture as the only possible cause of a difference.
The exact strict workspace Clippy command ran and failed on six diagnostics in bundled shell files. All four affected files are byte-identical to the PR base. The repository’s canonical command, with its documented allowances, passed without warnings. The build without default features emitted 68 warnings in unchanged files; workspace tests emitted eight warnings in an unchanged shell test file. No separate base build was rerun. Both workspace scripts reported that no scripted examples remain, so example execution is untested.
Review follow-up
The automated assessment of
f78391bffound a documentation conflict: the decision log still said all Linux startup required no opt-in. The follow-up scopes that earlier decision to ARM64 and records the authorized experimental x86 opt-in, including its caller setup cost. No runtime or policy change was needed for this correction. The current automated assessment accepts the correction, recommends approval, and reports no new findings. Its formal review isCOMMENTED; this is not human approval.Independent source review found no new defect in the x86 argument restrictions or process-creation path. Reviewers checked the failing-before/passing-after results, five deliberately broken permission checks, native command journals, unchanged canaries, and alternate-interface refusals. The current
mkdir,chmod, andopencalls have argument restrictions and regression coverage. This PR adds no guard that automatically covers future aliases such ascreat.The earlier review's
rmdirfinding is repaired and checked through complete Box launches. Its separatelinksuggestion remains deferred with the documented CLI maintenance limitation. Test failure messages no longer print user-ID arrays; both identity assertions remain.The earlier automated assessment for
379c173erecommends approval and reports no new blocking finding. It accepts the cleanup repair and explicitly accepts deferringlink. The bot records its formal review asCOMMENTED; its recommendation is not human approval.GitHub requires one approving review and resolution of open review threads. The earlier
rmdirand decision-log threads are resolved after the bot accepted both repairs.just check, orcargo test --workspace --all-features)cargo fmt --allandcargo clippy --workspace --all-targets --all-features -- -D warningsChecklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.