Repository navigation
Require Rust 1.99 for the contained media decoder - #65
James-Chapman wants to merge 1 commit into
Conversation
On a Linux Mint 22.3 VM, 7 of 10 contained_worker tests failed with the worker killed by SIGSYS (status 159). The cause is the toolchain, not glibc or the kernel: the workspace declared rust-version 1.96, but CI and all evidence use 1.99.1, and std before 1.99 breaks the contained decoder: - Before 1.97, the wasm32 allocator (dlmalloc 0.2.11) takes heap only from memory.grow. The guest's linear memory is fixed (initial == max), so every allocation fails and the guest traps on every input. - Before 1.99, std's runtime cleanup calls sigaltstack(SS_DISABLE) and munmap after main returns. sigaltstack is outside the Linux worker's seccomp allowlist, so the worker is killed after every reply. Raise rust-version to 1.99 so Cargo refuses older toolchains instead of building a broken guest and worker. The seccomp allowlist is unchanged; a note records why sigaltstack stays out. Document the requirement in docs/development.md and the allocator dependency in the decoder build script. Verified on the Mint VM with Rust 1.99.1: contained_worker 10/10, sandbox 26/26, worker tests pass; Rust 1.96.1 is refused by Cargo. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. WalkthroughThe workspace minimum Rust version changes from 1.96 to 1.99. Build-script and seccomp comments, along with development documentation, describe guest allocation and Linux worker cleanup behavior on older toolchains. ChangesRust toolchain requirement
Estimated code review effort: 2 (Simple) | ~8 minutes Change: Bug fix Merge Risk:
|
|



Summary
On a Linux Mint 22.3 VM, 7 of 10
contained_workertests failed: the media worker was killed by SIGSYS (status 159). The cause is the toolchain, not glibc or the kernel. The workspace declaredrust-version = "1.96", but CI and all evidence use 1.99.1, and std before 1.99 breaks the contained decoder.What changed
Cargo.toml:rust-versiongoes from 1.96 to 1.99, with a comment on both reasons. Cargo now refuses older toolchains instead of building a broken guest and worker.crates/media-worker/src/containment.rs: the seccomp allowlist is unchanged. A note records whysigaltstackstays out.crates/media-decoder/build.rs: a comment on the guest's dependency on the 1.97+ wasm allocator.docs/development.md: setup now requires Rust 1.99 or later and says why.Why it changed
memory.grow. The guest's linear memory is fixed (initial == max), so every allocation fails and the guest traps on every input. In-process sandbox tests fail the same way, with no worker or seccomp involved. dlmalloc 0.2.13 (Rust 1.97) first uses__heap_base..__heap_end.sigaltstack(SS_DISABLE)and thenmunmapaftermainreturns.sigaltstackis outside the allowlist, so the worker is killed after every reply, including successful ones.strace -kshows the call comes fromstd::rt::cleanup. In 1.99.0 and 1.99.1,sys::pal::unix::cleanup()is empty.Allowing
sigaltstackwould only patch 1.97 and 1.98. The supported toolchain never makes the call, so the allowlist stays minimal.Tests
Updated
None
New
None. The existing
contained_workerand sandbox suites detect both defects. The gap was that the declared minimum was never tested.Checks run:
contained_worker: 10/10 passed.persephone-media-sandbox: 26/26 passed.persephone-media-workertests: passed.cargo fmt --all -- --check: passed.python tools/dev.py check, the CI distribution containers, a release worker build, and arm64.🤖 Generated with Claude Code
🐰 CodeRabbit Summary
What changed
rust-versioninCargo.tomlfrom 1.96 to 1.99. Cargo refuses to build with older toolchains.crates/media-decoder/build.rsthat state the guest heap allocator requires Rust 1.97 or later. The comments also state that the workspacerust-versionenforces this requirement.crates/media-worker/src/containment.rsthat explain whysigaltstackstays out of the Linux seccomp allowlist. The comments state that Rust versions before 1.99 callsigaltstackduringmaincleanup, which gets a filtered worker killed after each reply. The comments also state that allowingsigaltstackcould hide a toolchain that builds a guest unable to allocate. No executable code changes in this file.docs/development.mdto require Rust and Cargo 1.99 or later. The page explains the failures that occur on older versions and namesrust-versionas the enforcement point.Why it changed
memory.grow. With the guest's fixed linear memory, that call fails and the guest traps on its first allocation.sigaltstackduring runtime cleanup. The worker seccomp allowlist does not permit this call, so the kernel kills the worker after it sends replies.rust-versionto 1.99 makes Cargo stop the build early. This prevents a broken guest or worker from being built.Scope
contained_workerpassed 10/10.persephone-media-sandboxpassed 26/26 on Linux and Windows with Rust 1.99.1.persephone-media-workertests passed on Linux. Cargo refused Rust 1.96.1.cargo fmt --all -- --checkpassed on Windows.python tools/dev.py check, CI distribution containers, a release worker build, and arm64.