Skip to content

Require Rust 1.99 for the contained media decoder - #65

Open
James-Chapman wants to merge 1 commit into
mainfrom
claude/inspiring-tharp-9b915e
Open

James-Chapman wants to merge 1 commit into
mainfrom
claude/inspiring-tharp-9b915e

Conversation

@James-Chapman

@James-Chapman James-Chapman commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

On a Linux Mint 22.3 VM, 7 of 10 contained_worker tests failed: the media worker was 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.

What changed

  • Root Cargo.toml: rust-version goes 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 why sigaltstack stays 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

  • Before 1.97, the wasm32 allocator (dlmalloc 0.2.11) gets 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. 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.
  • Before 1.99, std's runtime cleanup calls sigaltstack(SS_DISABLE) and then munmap after main returns. sigaltstack is outside the allowlist, so the worker is killed after every reply, including successful ones. strace -k shows the call comes from std::rt::cleanup. In 1.99.0 and 1.99.1, sys::pal::unix::cleanup() is empty.

Allowing sigaltstack would 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_worker and sandbox suites detect both defects. The gap was that the declared minimum was never tested.

Checks run:

  • Mint VM (fresh copy, Rust 1.99.1, with a guest built on Windows with 1.99.1 because the VM's 1.99.1 has no wasm target):
    • contained_worker: 10/10 passed.
    • persephone-media-sandbox: 26/26 passed.
    • persephone-media-worker tests: passed.
    • Rust 1.96.1: refused by Cargo.
  • Windows (Rust 1.99.1):
    • cargo fmt --all -- --check: passed.
    • Sandbox tests: 26/26 passed.
  • Not run: the full python tools/dev.py check, the CI distribution containers, a release worker build, and arm64.

🤖 Generated with Claude Code

🐰 CodeRabbit Summary

What changed

  • Raises the workspace rust-version in Cargo.toml from 1.96 to 1.99. Cargo refuses to build with older toolchains.
  • Adds comments in crates/media-decoder/build.rs that state the guest heap allocator requires Rust 1.97 or later. The comments also state that the workspace rust-version enforces this requirement.
  • Adds comments in crates/media-worker/src/containment.rs that explain why sigaltstack stays out of the Linux seccomp allowlist. The comments state that Rust versions before 1.99 call sigaltstack during main cleanup, which gets a filtered worker killed after each reply. The comments also state that allowing sigaltstack could hide a toolchain that builds a guest unable to allocate. No executable code changes in this file.
  • Updates docs/development.md to require Rust and Cargo 1.99 or later. The page explains the failures that occur on older versions and names rust-version as the enforcement point.

Why it changed

  • Toolchains before 1.97 use a wasm allocator that calls memory.grow. With the guest's fixed linear memory, that call fails and the guest traps on its first allocation.
  • Toolchains before 1.99 call sigaltstack during runtime cleanup. The worker seccomp allowlist does not permit this call, so the kernel kills the worker after it sends replies.
  • Setting rust-version to 1.99 makes Cargo stop the build early. This prevents a broken guest or worker from being built.

Scope

  • The seccomp allowlist does not change.
  • No public API declarations change.
  • Diff size: 4 files, 23 lines added, 2 lines removed.
  • Reported checks: contained_worker passed 10/10. persephone-media-sandbox passed 26/26 on Linux and Windows with Rust 1.99.1. persephone-media-worker tests passed on Linux. Cargo refused Rust 1.96.1. cargo fmt --all -- --check passed on Windows.
  • Not tested: the full python tools/dev.py check, CI distribution containers, a release worker build, and arm64.

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>
@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The 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.

Changes

Rust toolchain requirement

Layer / File(s) Summary
Minimum version and failure conditions
Cargo.toml, crates/media-decoder/build.rs, crates/media-worker/src/containment.rs, docs/development.md
The workspace minimum Rust version changes to 1.99. Comments and development documentation describe guest allocation failures before 1.97 and Linux worker cleanup behavior before 1.99. No executable code changes are reported.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Merge Risk: Minimal · up to 35b05

This change makes Cargo refuse Rust toolchains older than 1.99 and documents why. Developers on older toolchains will need to upgrade, but this replaces broken guest and worker builds with a clear error. There is no known merge risk.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: the workspace now requires Rust 1.99 instead of 1.96, and the change targets the contained media decoder. The raw summary shows the rust-version bump in Cargo.toml, th…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: the workspace now requires Rust 1.99 instead of 1.96, and the change targets the contained media decoder. The raw summary shows the rust-version bump in Cargo.toml, the build.rs and containment.rs comments, and the docs/development.md toolchain requirement, all tied to the decoder and its worker. The objectives confirm the same intent: Cargo should refuse older toolchains rather than build a broken guest or worker. The title is specific and concise, and it does not describe anything absent from the changeset.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5d8a97a0-2029-4b25-9921-a694b097df1c
Commits

Reviewing files that changed from the base of the PR and between cfe0194 and 35b05f5.

Files selected for processing: 4

  • Cargo.toml
  • crates/media-decoder/build.rs
  • crates/media-worker/src/containment.rs
  • docs/development.md

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant