supraj.dev

Kubernetes · Security

gVisor: a boundary for untrusted codeA userspace kernel between the workload and the host.

A container shares its host's kernel. gVisor puts a Go-written application kernel in the way: it intercepts the workload's system calls instead of handing them straight to the host. It's a practical boundary on ordinary nodes, with documented limits on compatibility, performance and what it can protect against.

Supraj Maripeddi · · 18 min read

Cover: an untrusted workload box sits above a Sentry layer and a host kernel layer, with a smaller Gofer process beside the Sentry. Arrows show system calls being intercepted rather than passed through.
Start hereYou run code you didn't write on nodes that also carry workloads you do trust.
Leave knowingWhat the Sentry intercepts, what the Gofer does, how to choose systrap or KVM, and how runsc becomes a RuntimeClass.
Keep in mindgVisor reduces the host attack surface. It is not a complete boundary and does not replace NetworkPolicy or seccomp.

Imagine this: a platform team runs a hosted CI service. Customers submit jobs as containers, and those nodes also carry the company's own trusted services. One submitted job probes unusual system calls and reaches for the node metadata address. The team needs that job to run without handing it the host kernel's entire system-call surface.

The team doesn't want a VM per job, and a syscall filter would need tailoring per runtime. That's the gap gVisor is built for: strong isolation that still looks like an ordinary container.

That's a scenario, not a report from a real incident.

One idea runs through the article: gVisor is a kernel implementation, not a rule set or a hypervisor. Once that clicks, its strengths and sharp edges make sense.

01 / The gap

Why isn't a container a security boundary?

Because a normal container and its host share one kernel. gVisor's docs describe it as an "application kernel" that "provides a strong layer of isolation between running applications and the host operating system". It implements a "Linux-like interface", it is written in a memory-safe language (Go), and it runs in userspace. [1]

It ships an OCI runtime called runsc. The docs say runsc "makes it easy to work with existing container tooling" and "integrates with Docker and Kubernetes, making it simple to run sandboxed containers". [1]

The docs add: "it is an application kernel, not a virtual machine hypervisor or a system call filter." [1] The security guide gives the motivation: "gVisor was created in order to provide additional defense against the exploitation of kernel bugs by untrusted userspace code." [3]

"Strong layer of isolation" is gVisor's own characterisation, a defence-in-depth claim, not a certification. The same docs warn that "a sandbox is not a substitute for a secure architecture". [3] Hold that thought for chapter five.

Ordinary container
The workload's system calls reach the host kernel. Isolation comes from namespaces, cgroups and whatever syscall filtering you have configured.
With gVisor
A userspace kernel implements the Linux-like interface in Go. The workload's calls are handled there before they can become host kernel calls.

02 / Under the hood

What sits between the workload and the host?

Two main processes do the work. The Sentry takes the role a kernel would for the workload. It's a from-scratch Go reimplementation of the Linux system-call interface, memory management, filesystems, network stack, process management, signals and namespaces. "Like a kernel, gVisor intercepts and handles system calls and page faults from the sandboxed workload." [2]

The boundary is deliberately strict: "gVisor never passes through any system call to the host. Therefore, if a kernel feature isn't reimplemented in gVisor, then the sandboxed workload cannot use it." [2] That one sentence explains both the security story and the compatibility story.

The Sentry does make some host calls: it "may make limited system calls to the host Linux kernel" when a request needs host information and the workload was configured to allow it. [2] There's no 1:1 translation of a guest syscall into a host one.

The Gofer is a sidecar for requests the restricted environment can't service. The docs call it "a slightly-more-trusted companion process running in a slightly-more-privileged context", and tie it to filesystem access. [2] Keep the hedge: slightly more trusted, not unrestricted host access.

Figure 1 · Where a system call goes

  1. Workload makes a Linux system call
  2. Sentry intercepts it in Go
  3. Gofer serves filesystem requests the Sentry can't
  4. Host kernel sees only the Sentry's limited calls
All 4 steps
  1. The guest call is serviced in the sandbox; the host kernel never sees that call directly.
The path described in the architecture and security guides. [2] [3]

03 / The positioning

Is this a VM, a syscall filter, or something else?

The docs answer all three at once: "gVisor is not a syscall filter (e.g. seccomp-bpf), nor a wrapper over Linux isolation primitives (e.g. firejail, AppArmor, etc.). gVisor is also not a VM in the everyday sense of the term (e.g. VirtualBox, QEMU)." [1]

Instead it "takes a distinct third approach, providing many security benefits of VMs while maintaining the lower resource footprint, fast startup, and flexibility of regular userspace applications". [1] The docs also call it "a merged guest kernel and VMM, or as seccomp on steroids" — their analogy, not a technical category.

The trade-off is plain: that flexible footprint comes "at the price of reduced application compatibility and higher per-system call overhead". [1] Chapters seven and eight cover both.

gVisor does use seccomp-bpf and namespaces, but "only as a second layer of defense, and not in a way that requires workload-specific tailoring in order to be meaningful". [1] No per-runtime syscall allowlist to maintain.

The docs call VMs "the gold standard of workload isolation" but note the "steep cost in terms of resource overhead and efficiency" of booting a full kernel. [1] Chapter ten sets a first-party counterpoint beside it.

04 / Defence in depth

What does the security model actually promise?

The stated goal is "to minimize the System API attack vector through multiple layers of defense, while still providing a process model". Two principles drive it: the Sentry intercepts the application's direct host API interactions, and the system API available to the Sentry itself is reduced to "a safer, restricted set". [3]

The engineering rules are concrete:

  • "No system call is passed through directly to the host." Each supported call has its own implementation, "unlikely to suffer from identical vulnerabilities that may appear in the host". [3]
  • "Only common, universal functionality is implemented." Specialised APIs reached through extended attributes, raw sockets or ioctls are not implemented or passed through. [3]
  • The host surface exposed to the Sentry "is explicitly enumerated and controlled". The Sentry "is not permitted to open new files, create new sockets or do many other interesting things on the host". [3]
  • Unsafe code "is isolated in files that end with 'unsafe.go'" so it can be audited, and "no file without the unsafe suffix may import the unsafe package". [3]
  • "No CGo is allowed. The Sentry must be a pure Go binary." [3]

The docs describe continuous fuzzing of the Sentry and triage of production crashes. [3] That's a development practice, not a guarantee.

Don't over-read this

The security guide rejects a simple ranking: "one should not assume that the mere use of virtualization hardware makes a system more or less secure." Its own bottom line is broader — "A sandbox is not a substitute for a secure architecture." An exploitable network service on the host is outside what gVisor changes. [3]

05 / The hard limits

What doesn't gVisor protect against?

The docs include a section on where gVisor does not help. It is worth reading as a list. [2]

  • Compromised components above the sandbox. An exploit in containerd that makes it start a container without gVisor is outside the boundary. [2]
  • Spectre-style CPU side channels. gVisor intercepts system calls and page faults, not how the application uses the CPU within host cgroup limits. Those need host kernel or hardware mitigation. [2]
  • Exploits inside the workload itself. If a sandboxed web app is exploited through its own code, the attacker still has whatever that sandbox was configured to reach. gVisor helps stop the escape outward. [2]
  • Hardware side channels generally. The docs say gVisor "relies on the host operating system and the platform for defense against hardware-based attacks" and that there is "little defense that gVisor can provide" given their nature. [3]
  • Resource exhaustion and denial of service. gVisor "relies on the host resource mechanisms (cgroups)". In-sandbox cgroups can account for CPU and memory, but "resource limits are not enforced within the sandbox"; it cannot enforce limits between processes in the same sandbox. [3] [7]

The security model says network policy "should be applied at the container level to ensure appropriate network policy enforcement". [3] Google Cloud agrees: untrusted code may still reach databases, APIs, other containers and CSI drivers, and those services "need to be individually protected". [15]

06 / Two platforms

Systrap or KVM — which platform do you run?

"There are currently two supported platforms." [2] Systrap is the default. It uses Linux's seccomp-bpf for system call interception rather than filtering, needs no virtualisation support from the host, and is therefore "well-suited to run inside a virtual machine". [2]

KVM uses the Linux KVM subsystem for address-space isolation and page-fault interception; workload code runs in guest ring 3. It requires virtualisation support, works with nested virtualisation but is "generally slower than Systrap in such a mode". [2] The platform guide adds that it "runs best on bare-metal setups". [4]

A third name remains in the codebase: ptrace, "replaced" by systrap as the default in mid-2023. It "continues to exist" but "is no longer supported and is expected to eventually be removed entirely". Don't deploy on it. [4]

Platforms are "meant to be transparently interchangeable from the system administrator's perspective", but the docs add that "they are still different from a security perspective" because the underlying kernel functionality differs. [2]

You choose with the --platform flag passed to runsc; systrap is the default. In Docker, the user guide shows passing "--platform=kvm" through runtimeArgs in /etc/docker/daemon.json. The same page says to use KVM on bare metal only, and calls nested virtualisation "historically a cause of security issues" and "not recommended for production". [5]

Figure 2 · Which platform fits the node?

Where will the sandboxed workload run?

Pick the node type to see the documented platform guidance.

A rule of thumb from the platform docs, not a benchmark. Systrap needs no virtualisation and is the default; KVM needs /dev/kvm access and runs best on bare metal. [4] [5]

07 / The cost

What does sandboxing cost at runtime?

The performance guide says it upfront: "gVisor imposes runtime costs over native containers." Those costs show up as "additional cycles and memory usage, which may manifest as increased latency, reduced throughput or density, or not at all". [6]

Two kinds. Structural costs come from the Sentry itself: extra memory and extra software layers per application system call. Go, chosen for memory safety, "may not yet offer the raw performance of other choices". Implementation costs come from a less mature independent implementation; the network stack is the example, still evolving and "less CPU efficient" than mature stacks. [6]

Workload shape matters more than any ratio. The cost "will principally impact applications that are system call bound, which tend to be high-performance data stores and static network services", and "the impact of system call interception will be lower the more work an application does". The sandbox has "a small, mostly fixed amount of memory overhead". [6]

About those graphs

Except where specified, the published graphs were generated with the ptrace platform, which the docs describe as having "the highest structural costs by far" and as "in no way represents an ideal scenario". They advise readers to "use Systrap for best performance in most cases", so those charts are no forecast for systrap. This article quotes no numbers from them. [6]

The production guide puts it plainly: I/O-heavy work such as databases and network-heavy work such as load balancers will see degraded performance, while CPU-bound work such as API servers and data pipelines will see "minimal or no overhead". [11]

08 / Compatibility

What doesn't work the same inside the sandbox?

The compatibility guide is blunt: gVisor implements "a large portion of the Linux surface", but "there are (and always will be) unimplemented features and bugs. The only real way to know if it will work is to try." [7] It also rejects a syscall list as a proxy: that "is not necessarily a good measure of how widely compatible gVisor is in practice". [7]

There is good news for common runtimes. Releases go through the regression tests of Python, Java, Node.js, PHP and Go, which the docs say means "most programs written in these languages will work". [7]

The named gaps are the ones to check against your workload:

  • In-sandbox cgroups do CPU and memory accounting, not enforcement. [7]
  • Block filesystems such as fat32, ext3 and ext4 "are not natively supported inside the gVisor kernel", so you cannot mount block devices from within the sandbox. [7]
  • iptables is "only partially supported", and nftables support is similarly limited. [7]
  • Custom hardware device files are generally unsupported, with "the notable exceptions of NVIDIA GPUs and TPU devices". [7]
  • io_uring is "disabled by default" and limited to basic I/O when enabled. [7]
  • Using KVM from inside the sandbox is unsupported; the docs note this is separate from whether gVisor itself uses the KVM platform. [7]

Networking has caveats. The default is gVisor's userspace network stack; switching to the host stack with --network=host "decreases the isolation to the host". [10] Docker's user-defined bridge puts DNS at 127.0.0.11 on the host network, which an isolated runsc network cannot reach, so lookups fail — though "container name lookup works fine in Kubernetes". [9] In proxy mode, "the external peer is responsible for any egress filtering" — gVisor is not your egress control plane. [10]

GKE has its own list of incompatible features for sandboxed Pods; don't generalise it to every gVisor deployment. [15]

09 / Making it run

How does runsc become a Kubernetes RuntimeClass?

Start with the host: gVisor "supports x86_64 and ARM64, and requires Linux 5.6+". The install guide recommends the latest release for production. Releases are weekly and named release-<yyyymmdd>.N, with no long-term support: "users are expected to track the newest release". Each artifact has a .sha512 companion, and the guide says to verify the digest before installing. [12] [13]

The newest release is release-20261116.0, published on 17 November 2026. The yyyymmdd is the Monday of the week the branch was cut, not the publication date. [13] [14] With a weekly cadence, check the release page before you pin anything.

Next, register runsc with containerd. The pinned quick start adds a runtime handler io.containerd.runsc.v1, tells containerd 2.x users to consider version = 3, and restarts containerd. Minimum supported versions: 1.3.9 or 1.4.3. [8]

# /etc/containerd/config.toml (version = 2 form from the quick start)
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc]
  runtime_type = "io.containerd.runc.v2"
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runsc]
  runtime_type = "io.containerd.runsc.v1"

Then create a RuntimeClass whose handler is runsc, and name it on the Pod. [8]

apiVersion: node.k8s.io/v1
kind: RuntimeClass
metadata:
  name: gvisor
handler: runsc
---
apiVersion: v1
kind: Pod
metadata:
  name: nginx-gvisor
spec:
  runtimeClassName: gvisor
  containers:
  - name: nginx
    image: nginx

The quick start verifies with sudo crictl exec ${CONTAINER_ID} dmesg | grep -i gvisor. [8] GKE's docs show kubectl exec POD_NAME -- uname -r returning something like 4.19.0-gvisor while the host reports a different kernel, and add that checking the RuntimeClass is "more trustworthy than running a command inside the Pod, because you won't see data from inside the sandbox itself. Anything reported from within the sandbox is untrustworthy, because it could be defective or malicious." [16]

Omitting the field is not an error

GKE describes a regular Pod as having "no RuntimeClass value, which means that the Pod isn't in a sandbox". It runs without a sandbox — a different failure from naming a RuntimeClass the CRI can't handle. Check the field and verify at the node. [16]

GKE Sandbox manages the wiring: specify the built-in gvisor or microvm RuntimeClass and the Pod lands on a matching sandbox node pool. The microvm class and sandbox-type mapping are GKE-specific; on a self-managed cluster you create your own RuntimeClass with handler: runsc. [16]

Figure 3 · From binary to sandboxed Pod

  1. Install a pinned runsc release
  2. Register the containerd runtime handler
  3. Create RuntimeClass with handler: runsc
  4. Set runtimeClassName on the Pod
  5. Verify at the node, not from inside
All 5 steps
  1. Five steps from a downloaded binary to a Pod you can verify as sandboxed.
From the gVisor containerd quick start and GKE's sandbox Pod guide. [8] [16]

10 / The decision

When would you pick a microVM instead?

Google Cloud's GKE Sandbox docs put the two options side by side — the cleanest first-party comparison available. They describe gVisor as a userspace re-implementation of the Linux kernel API giving a "subset of Linux kernel syscalls", with "syscall interception in a userspace kernel" and "dynamic overhead with low base memory". [15]

They describe microVMs as lightweight VMs running a full Linux kernel, one per Pod, with "full hardware virtualization with a dedicated guest kernel" and "fixed overhead of 250 mCPU and 130 MiB of memory for each Pod". GKE implements this with Kata Containers and the Cloud Hypervisor VMM. The same page says microVMs "provide stronger isolation than gVisor sandboxes". [15]

That is a first-party position, not a universal law. gVisor's security guide pushes the other way: "one should not assume that the mere use of virtualization hardware makes a system more or less secure." [3] The concrete differences are a dedicated guest kernel and broader syscall compatibility on one side, lower fixed cost and faster start on the other.

Figure 4 · GKE's two sandbox types

Kernel access
Subset of Linux kernel syscalls
Isolation level
Syscall interception in a userspace kernel
Overhead
Dynamic overhead with low base memory
Start time
Less than 100 ms
GKE nodes
GKE Standard and Autopilot; on by default in Autopilot
GPUs and TPUs
Supports specific GPU models and TPU versions
GKE RuntimeClass
gvisor
Example workload
Untrusted third-party apps and web frontends
Google Cloud's figures for its two GKE Sandbox types, captured 23 November 2026. They are GKE-specific, not intrinsic properties of gVisor, Kata Containers or any other technology. [15] [16]

GKE's split is worth quoting: microVMs suit "AI agents that generate and execute code without supervision" and high-volume, low-overhead syscall workloads; gVisor suits "untrusted or third-party applications" in Rust, Java, Python, PHP, Node.js or Go, plus web frontends, caches and proxies. [15]

The production guide adds realism. Worth sandboxing: externally reachable endpoints, sensitive or regulated workloads, multi-tenant platforms and untrusted code. But "while gVisor is able to sandbox any application, it should generally not be used to sandbox every application". Reduce the outside attack surface first. The guide says gVisor protects against "most Linux CVEs" and container escape vulnerabilities, and makes remote privilege-escalation attacks "less impactful" — note most. [11]

What I'd do
  1. Use gVisor as the default boundary for untrusted code on ordinary nodes, and leave trusted first-party workloads unsandboxed — GKE says there is "generally no advantage" in sandboxing them. [15]
  2. Reach for a microVM RuntimeClass when you need a dedicated guest kernel, broader syscall compatibility in that environment, or hardware-virtualisation isolation; on GKE that means Kata Containers with Cloud Hypervisor, which needs Standard nodes with nested virtualization and doesn't support GPUs or TPUs. A sandboxed GPU or TPU workload on GKE stays on gVisor. [15]
  3. Treat NetworkPolicy, seccomp and cgroups as still required. gVisor adds a layer; it does not replace them. [3] [2]

Keep these names

A small glossary

Application kernel
A Linux-like kernel interface written in Go and running in userspace, between applications and the host OS.
Sentry
The component that intercepts and handles guest system calls and page faults in Go, instead of passing them to the host.
Gofer
A slightly-more-trusted sidecar process that handles filesystem requests the Sentry cannot service directly.
runsc
The OCI runtime that plugs gVisor into Docker and Kubernetes.
seccomp-bpf
A Linux facility used normally for syscall filtering, and by the systrap platform for syscall interception.
systrap
The default gVisor platform. Uses seccomp-bpf for interception and needs no host virtualisation support.
KVM platform
A gVisor platform using Linux KVM for address-space isolation. Best on bare metal; nested use is not recommended for production.
RuntimeClass
A Kubernetes object that maps a name to a container runtime handler; the Pod field runtimeClassName selects it.
MicroVM
A lightweight VM with a dedicated guest kernel. GKE implements its microVM sandbox with Kata Containers and Cloud Hypervisor.
Defence in depth
Layered isolation. gVisor narrows the host API surface but assumes other controls remain in place.

Check the concept

Can you explain it back?

1. Does gVisor make no system calls to the host kernel?

No. No guest system call is passed through directly, but the Sentry itself may make limited host calls when servicing a request requires host information and that access was configured.

2. Why does gVisor have compatibility gaps at all?

Because the Sentry reimplements Linux in Go. If a feature has not been reimplemented, the sandboxed workload cannot use it — the docs call this out explicitly.

3. Which platform would you run on a nested VM, and why?

systrap, the default. It needs no virtualisation support, and the docs say it will often perform better than KVM under nested virtualisation, which they do not recommend for production.

4. A Pod omits runtimeClassName. Is it sandboxed?

No. GKE describes such a Pod as having "no RuntimeClass value", meaning it is not in a sandbox. Check the field and verify at the node.

5. Do you still need NetworkPolicy after adding gVisor?

Yes. Untrusted code can still reach services outside the sandbox, and both gVisor and Google Cloud say network policy belongs at the container level.

Continue the thread

Around the same cluster

Read further

Sources

All accessed 23 November 2026. gVisor documentation is version-pinned to tag release-20261116.0; the rendered docs pages are linked for readability. Google Cloud pages are live and undated.

  1. gVisor docs: Overview
  2. gVisor docs: Introduction to gVisor architecture
  3. gVisor docs: Security model
  4. gVisor docs: Platforms (architecture guide)
  5. gVisor docs: Platforms (user guide)
  6. gVisor docs: Performance
  7. gVisor docs: Compatibility
  8. gVisor docs: containerd quick start
  9. gVisor docs: FAQ
  10. gVisor docs: Networking
  11. gVisor docs: Production guide
  12. gVisor docs: Install
  13. gVisor docs: Release process
  14. gvisor/gvisor: release-20261116.0 tag
  15. Google Cloud: GKE Sandbox overview
  16. Google Cloud: Set up GKE Sandbox Pods

Written with AI assistance. Technical sources are listed above.