Skip to content

2. Sandbox

2. Sandbox

Result: works rootless, with one important catch. gVisor runs under rootless Podman on smaug, but only when told to ignore cgroups, which means no CPU or memory limits on the sandbox.

Setup (2026-11-22)

  • gVisor release-20261116.0. Releases now ship as a tarball holding runsc and a gvisor-bin/ directory (the old bare .../latest/x86_64/runsc URL returns 404):
U=https://storage.googleapis.com/gvisor/releases/release/latest/$(uname -m)
curl -fsSLO $U/gvisor.tar.zstd && curl -fsSLO $U/gvisor.tar.zstd.sha512
sha512sum -c gvisor.tar.zstd.sha512
tar --zstd -xf gvisor.tar.zstd -C ~/.local/opt/gvisor

No root. The install page warns runsc should be readable by all users because the Sentry may re-exec as an unprivileged user; ~/.local is mode 700 on smaug and rootless runs were unaffected. - Podman 5.4.2, rootless, cgroups v2, default runtime crun. - Run as podman --runtime ~/.local/opt/gvisor/runsc --runtime-flag ignore-cgroups run --rm docker.io/library/alpine:3.20 …

Raw results

Without ignore-cgroups:

  • default: creating container: systemd error: Interactive authentication required.
  • --cgroup-manager=cgroupfs: open /sys/fs/cgroup/cgroup.subtree_control: permission denied

With it, inside the sandbox uname reports 4.19.0-gvisor and dmesg shows Starting gVisor....

Workload (wall clock, s) runsc crun
run --rm … true, 5 warm runs 0.201–0.241 0.196–0.214
head -c 200MB /dev/zero \| sha256sum 3.23 1.18
20,000 empty-file creates in /tmp 0.90 1.34

The image was pulled before timing; the first-ever run was not timed.

What we learned

  • Start cost is negligible. About 20–30 ms over crun per container. Job start time will be dominated by everything else.
  • Pipes and syscalls in a hot loop cost about 3×. The "CPU" test is really 200 MB through a pipe. Test suites that shell out a lot, or stream heavily between processes, will feel this. Experiment 4 gives the real number.
  • Small-file work in /tmp was faster under gVisor, because its root overlay lives in the sandbox's memory by default. That memory counts against the job, which matters given the next point.
  • Rootless means no resource limits. Rootless Podman can't hand gVisor a cgroup here, so a runaway job can take all of smaug's memory, including what the ZFS cache would give back. That breaks "a job can't hurt the owner's machine".

What it changes

The runner needs cgroups. Two options to evaluate later, both needing a one-time root step by the owner: systemd user-session cgroup delegation (so rootless runs get a delegated subtree), or a rootful runner service. For the rest of this spike, ignore-cgroups is acceptable; for the product it is not.