Skip to content

fix(preview): limit sandbox fsize to software media decoding - #2803

Merged
l0gicgate merged 2 commits into
mainfrom
fix/2793-hardware-media-fsize-limit
Nov 24, 2026
Merged

l0gicgate merged 2 commits into
mainfrom
fix/2793-hardware-media-fsize-limit

Conversation

@JoeJoeflyn

Copy link
Copy Markdown
Collaborator

Description

Scope the process-wide 512 MiB --fsize limit to Backend::Software in media decode sandboxes, matching the existing --as address space limit.

Accelerated hardware decoders (such as Vulkan with Mesa ANV or VA-API) reserve sparse memfd state tables (e.g. 1 GiB) during device and buffer pool initialization. When constrained by --fsize=536870912, ftruncate returns EFBIG and the kernel terminates the FFmpeg process with SIGXFSZ (exit code 153).

Visual evidence

N/A (backend process resource limit change for sandbox helper).

How to test

  1. Preview a video file on a system using Vulkan (e.g. Intel Arc / Mesa ANV) or run the command assertions test:
./scripts/test-headless.py sandbox_helper::media::tests::commands
  1. Verify that hardware decoding commands omit --fsize and --as while retaining --core=0, and software decoding commands retain both --fsize=536870912 and --as=2147483648.

Expected result:

Hardware video decoders initialize and decode media without failing or being terminated by SIGXFSZ (EFBIG).

Related issue

Closes #2793

Hardware-backend media decoders (such as Vulkan with Mesa ANV) allocate
sparse driver state tables (e.g. 1 GiB memfd) during device initialization.
The process-wide 512 MiB --fsize limit caused the kernel to kill hardware
FFmpeg processes with SIGXFSZ (EFBIG). Scope --fsize to Backend::Software,
matching --as.

Closes #2793
@github-actions github-actions Bot added the fix label Nov 24, 2026
@l0gicgate

Copy link
Copy Markdown
Contributor

Review and cleanup

Merged main at 82de6a97f (merge commit a4e9856b7). No conflicts; main only brought workflow changes.

Review against the description and #2793. No changes were needed.

  • ffmpeg_command now applies --fsize=536870912 only to Backend::Software, alongside --as; --core=0 stays on every backend. This is the fix the issue proposes.
  • Hardware decoders are still bounded without the file limit: the media helper is not wrapped in an outer prlimit (sandbox/command.rs skips bind_output_with_limits for media operations), so no inherited hard limit defeats the change, and writes remain confined by Landlock to the private scratch mounts, with /tmp capped by the bubblewrap --size tmpfs limit.
  • The audio, peaks and cover paths all call ffmpeg_command(&Backend::Software) and keep both limits.
  • docs/preview-sandbox.md matches the new behaviour.
  • The one added code comment states the driver constraint behind the exemption; kept.
  • There were no reviews or review comments to reconcile.

Tests. assert_every_backend_decodes_within_bounds now checks --core=0 on every backend and --fsize=/--as= only on software, so it fails if the limit returns to hardware backends or is dropped from software. Nothing tautological was added; nothing removed.

Validation

  • ./scripts/test-headless.py sandbox_helper::media::tests — 14 passed, 0 failed
  • cargo fmt --all --check — clean
  • Not run locally: clippy and the full Rust suite (the review made no code changes and the change is confined to one function in strata-preview; CI covers both). No hardware reproduction on Mesa ANV was attempted.

CI. The earlier Rust tests shard 1 failure was ui::window::tests::keyboard_dispatch::icon_motion::tenxer_icons_move_spatially_open_explicitly_and_peek, a GTK keyboard test this PR does not touch. The merge push started a fresh run.

@l0gicgate

Copy link
Copy Markdown
Contributor

CI: all checks green on a4e9856b7 (shard 1 passed on the fresh run; QA scenarios and Proof are skipped on pull requests).

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Video preview: hardware FFmpeg killed by SIGXFSZ under the 512 MiB --fsize limit (Mesa ANV)

2 participants