gVisor in Production: Lessons and Limitations
The Sentry/Gofer architecture, how runsc plugs into Docker, containerd, and Kubernetes, and an honest look at performance overhead, compatibility gaps, and when gVisor is the right sandbox.
Published on • November 15, 2026
AI Assistant

gVisor sells itself as “the sandbox kernel” — a memory-safe, Linux-compatible user-space kernel that isolates workloads without virtual machine overhead. Google runs it under Cloud Run, GKE Sandbox uses it for untrusted workloads, and it has become the default answer for “I need to run other people’s code on my machines.” But adopting gVisor in production means accepting a re-implementation of Linux as your compatibility surface. This post covers how gVisor’s Sentry and Gofer architecture actually works, how runsc slots into your container stack, and the performance and compatibility realities teams hit after the demo.
The Architecture: Sentry, Gofer, and Platforms
gVisor’s core idea is a dual-kernel model like a VM, but the inner kernel runs in userspace. Three components matter:
The Sentry is the gVisor kernel. It intercepts every syscall and page fault from the sandboxed workload and services them entirely within gVisor’s own code — a from-scratch reimplementation of the Linux syscall interface, memory management, virtual filesystem, network stack, process management, signals, and namespaces, all written in memory-safe Go. Crucially, gVisor never passes a workload’s syscall through to the host kernel. If the workload calls getpid(), the Sentry answers from its own PID table (sandboxed processes are not host processes — top on the host won’t show them). If a feature isn’t reimplemented, the workload simply cannot use it.
The Gofer is a sidecar process with slightly more privilege, used for host filesystem access the Sentry can’t perform itself. The Sentry runs with a stripped-down seccomp filter (no exec, no connect), an isolated mount namespace with pivot_root, and minimal capabilities — so when a file operation needs the real host, the Gofer does it on the Sentry’s behalf. Data crossing that boundary carries a small, structural cost.
Platforms are how the Sentry intercepts syscalls in the first place. gVisor currently ships two:
- Systrap (the default): uses
seccomp-bpffor syscall interception rather than filtering. No hardware virtualization required, which makes it ideal for running inside VMs and on any host. - KVM: uses the KVM subsystem for address-space isolation and page-fault interception; sandboxed code runs in guest ring 3. Requires virtualization support and runs poorly under nested virtualization.
(The older ptrace platform still appears in some documentation and benchmarks, but Systrap replaced it — and the performance guide warns that ptrace “suffers from the highest structural costs by far,” so don’t benchmark on it.)
Defense in depth runs both ways: the workload is sandboxed from the Sentry, and the Sentry itself is sandboxed from the host via seccomp, namespaces, cgroups, and pivot_root. To escape, an attacker must exploit the Sentry and the host kernel — two codebases that share nothing.
Running It: Docker, containerd, and Kubernetes
gVisor ships as runsc, a standard OCI runtime — the same interface as runc, so the entire container ecosystem works unchanged:
# One-off test
sudo runsc do echo Hello world
# Docker
sudo docker run --rm --runtime=runsc -it ubuntu /bin/bash
# Rootless, no networking
runsc --rootless --network=none do dmesg
The dmesg example is a nice smoke test: inside runsc, it prints gVisor’s (deliberately whimsical) kernel log messages instead of failing with “Operation not permitted.”
In containerd you register runsc as a runtime handler; Kubernetes wires it up as a RuntimeClass:
apiVersion: node.k8s.io/v1
kind: RuntimeClass
metadata:
name: gvisor
handler: runsc
Then pods opt in with runtimeClassName: gvisor. No custom pod specs, no VM images, no hypervisor network bridges — gVisor implements the OCI Runtime Spec, so it’s just another runtime. CRI-O is also supported, and rootless mode exists for sandboxes that don’t need networking (setup needs privileges only to configure the userspace network stack; runsc re-execs and drops privileges before untrusted code runs).
One operational note: runsc do grants read-only access to the host filesystem as a convenience. For anything resembling a security evaluation, install it as a Docker/containerd runtime where the OCI config strictly defines the mounts.
Performance Overhead: The Realities
gVisor’s own performance guide is refreshingly honest, and the numbers break down by workload shape:
- CPU-bound workloads: effectively zero overhead. The Sentry doesn’t emulate or interfere with instruction execution — application code runs natively. TensorFlow training, data processing, and compression pay almost nothing. This is why AI/agent sandboxing has become gVisor’s headline use case.
- Syscall-bound workloads: the tax is structural. Every syscall crosses an interception boundary whose cost depends on the platform (Systrap vs KVM). Workloads doing little userspace work per syscall feel it most: the guide’s Redis benchmarks show large overhead on small operations (
GET,SET) and much smaller relative overhead onLRANGE, where the application does real work between syscalls. - Networking: implementation costs. The Sentry runs a userspace network stack (netstack) written in Go. It’s less CPU-efficient than the host kernel stack and lacks some advanced recovery mechanisms.
iperfthroughput regresses noticeably; the guide says the stack “is improving quickly,” but plan for it. - Filesystem: VFS costs in metadata-heavy paths. Raw disk I/O is fine — the disk becomes the bottleneck. But operations routed through the Gofer and gVisor’s internal VFS add fixed per-operation cost, which shows up badly in pathological cases like Apache serving 100 KB static files with many concurrent connections. Heavy
stat/open/readloops of small files are the classic regression. - Memory: small, mostly fixed. The Sentry holds a fixed footprint plus a bit per open socket/file — far below a guest kernel’s baseline, and unlike microVMs it allocates and releases host memory natively (no ballooning, no fragmentation).
- Startup: container-like. Most measured startup overhead in the Docker benchmark was Docker itself, not
runsc.
The practical lesson: benchmark your workload. “gVisor has 10% overhead” is meaningless; the distribution ranges from ~0% (compute) to multiples (syscall-dense microservices).
Compatibility Gotchas
Because the Sentry never forwards syscalls to the host, compatibility is bounded by what gVisor has reimplemented:
- Unimplemented syscalls return errors (typically
ENOSYS), and they fail only underrunsc— the classic “works on my machine, dies in the sandbox” failure. The project’s application compatibility pages exist for a reason: test your actual images before rollout. - eBPF-based tooling doesn’t work inside the sandbox. Tools that expect to load BPF programs, use
perf, or read host kernel state (many security agents, some service meshes’ kernel components) need to run on the host side instead. - Some IPC, mmap, and
io_uringedge cases have historically been incomplete or partial. Verify anything unusual — shared-memory tricks, exoticfcntlusage,inotifysemantics. - The userspace network stack has limits. Applications relying on raw sockets, packet capture, or kernel-level packet manipulation won’t behave like they do under
runc. gVisor supports CNI integration for Kubernetes networking, but the stack is gVisor’s own. - GPU/TPU support exists now — driver operations relay to host kernel drivers — but it’s newer territory than core syscalls; validate CUDA workloads explicitly.
- What gVisor explicitly does not protect against: exploits in the container runtime itself (a containerd bug that starts a container without gVisor), Spectre-style side channels (mitigate at the host/hardware level), and application-level compromises inside the sandbox (nginx+PHP exploited via PHP is still an owned sandbox — isolate per tenant).
Operational Lessons from Production
A few patterns that separate successful deployments from painful ones:
- Don’t sandbox what doesn’t need it. The performance guide itself notes a sandbox gives minimal benefit for a trusted database — the user data is already inside, so there’s no attacker to keep out. Reserve
runscfor untrusted or multi-tenant code. - Isolate per trust boundary. Different customers in different sandboxes; gVisor contains breakouts but doesn’t prevent one sandboxed tenant from abusing what its sandbox can access.
- Instrument the boundary. gVisor’s runtime monitoring feature streams trace points to external threat-detection engines, giving you visibility into sandbox behavior that traditional host-level eBPF tooling can’t see from inside.
- Plan upgrades like a kernel upgrade.
runscis your kernel now; new releases add syscall coverage and performance work, and your compatibility suite should gate upgrades. - Checkpoint/restore changes the economics. gVisor can snapshot a running sandbox and resume it elsewhere in milliseconds — useful for warming services, forensics, and agent session management, but it’s stateful infrastructure you now have to operate.
When It Is the Right Choice
gVisor is the right choice when you run untrusted, bursty, density-sensitive workloads: CI runners executing contributor code, multi-tenant function platforms, AI agents running LLM-generated code, and any environment where the host kernel’s patch cadence is a security liability. You get a VM-grade boundary with container-native density, instant starts, and no nested virtualization.
It’s the wrong choice when your workload needs kernel features gVisor hasn’t reimplemented, when you depend on eBPF observability inside the sandbox, when raw packet access matters, or when the workload is so syscall-dense that the interception tax dominates your latency budget. For those cases, step up the isolation spectrum to microVMs — or accept runc with a hardened host.