Skip to content

docs(sandbox): record the cgroup limits evaluation and defer it (#748) - #982

Merged
ajianaz merged 2 commits into
developfrom
feat/sandbox-cgroup-eval
Nov 19, 2026
Merged

ajianaz merged 2 commits into
developfrom
feat/sandbox-cgroup-eval

Conversation

@ajianaz

@ajianaz ajianaz commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

What

Adds docs/sandbox-design.md section 12.1: the evaluation of cgroup limits for the sandbox, with the decision to defer. Updates the other places that said "later work" (section 2.2, section 15) and fixes a pre-existing line in section 12 that said tole sizes /tmp (it does not). No code change.

Why

The last open sandbox item of #748 is "cgroup limits, only if cheap (deferred)". The evaluation says it is not cheap, so this records why and the exact condition to revisit, instead of leaving it implicit.

Changes

  • Section 12.1: what the rlimits bound (CPU, address space, processes, file size, per process) and what they cannot (tree-aggregate memory, tmpfs fill, total CPU, in-sandbox wall clock, tree kill, and any kill for job_start trees); how an unprivileged tole could get a cgroup v2 and where neither route is available; the fail-closed shape it would need under [sandbox.consumers] (three-state rule, warning plus tole doctor line like the other command consumers, never an implicit default); the cost; the verdict; revisit conditions; and what the sandbox still does not cover.
  • Section 2.2, section 15 and section 3 (systemd-run line) point to or soften toward 12.1; section 12 no longer claims /tmp is sized.

Testing

  • Docs only. Claims checked against crates/tole-core/src/sandbox/command.rs (Limits defaults, die_with_parent, setrlimit between fork and exec), sandbox.rs (--tmpfs /tmp, no size), delegation/resource_guard.rs (cgroup v2 read-only parsing) and .github/workflows/ci.yml (sandbox-bwrap job, sudo sysctl).
  • One anecdotal host probe (2026-11-19, a single container): cgroup v1 hybrid, cgroup2 mounted read-only at /sys/fs/cgroup/unified, systemd-run --user --scope true fails with "Failed to connect to bus: No medium found", PID 1 not systemd. Not a claim about CI or other hosts.
  • Independent read-only review: a fresh read-only reviewer session challenged the claims against the code. It verified the limits defaults (3600 s, 16384 MiB, 4096 processes, 4096 MiB) set in pre_exec between fork and exec, RLIMIT_AS being per process, resource_guard.rs reading cgroup v2 read-only, the sandbox-bwrap job description, the three-state rule, and the section 2.2 and 15 cross-references. It found wording issues (ledger line for command consumers, --die-with-parent not applying to jobs, overstated CI and systemd claims, the section 12 /tmp sizing line); all are fixed in the second commit.

Section 12.1 of docs/sandbox-design.md records what the rlimits bound, what cgroup v2 would add, where it is unavailable, the fail-closed shape it would need, its cost, why it is deferred and the condition to revisit.
…#748)

Command consumers have no ledger line (warning and doctor only), jobs have no --die-with-parent and no caller-timeout bound, the CI and systemd-run claims are softened to what was verified, and the section 12 line about sizing /tmp now matches the code (the tmpfs is unsized).
@ajianaz
ajianaz marked this pull request as ready for review November 19, 2026 08:14
@ajianaz
ajianaz merged commit c6fac21 into develop Nov 19, 2026
23 of 24 checks passed
@ajianaz
ajianaz deleted the feat/sandbox-cgroup-eval branch November 20, 2026 08:37
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