blog.rust.gay

Hyperlight runs unmodified Linux programs in millisecond micro-VMs

There is a gap in the sandbox market. A process sandbox is fast but shares the host kernel. A full virtual machine is isolated but slow to start. A WebAssembly sandbox is fast and portable but limited by the languages and libraries that compile to Wasm. For a workload that runs untrusted code for a few milliseconds, none of the three is a perfect fit. The process sandbox is too weak, the VM is too slow, and Wasm is too restrictive.

Hyperlight is an attempt to fill that gap. It is a CNCF Sandbox project that describes itself as a library virtual machine monitor written in Rust. Unlike QEMU or Firecracker, Hyperlight is linked into the host application as a library, not run as a separate VMM process. It creates micro-VMs with no emulated devices, and the host controls access through a capability-based allow-list. The guest gets a minimal environment; the host decides what it can see.

The project has had a Wasm backend (hyperlight-wasm) and a JavaScript backend (hyperlight-js). The new piece is hyperlight-unikraft, a backend that runs a unikernel built with Unikraft, a Linux Foundation project. The important part is not the unikernel. It is the claim that the backend runs unmodified Linux binaries: Python, Node.js, .NET, Java, PHP, Go, Rust, C, Bash, and PowerShell, on x86_64 and arm64, with no SDK, no libc port, and no recompile. You provide a base rootfs and a Dockerfile-like build; hluk, the CLI, builds a unikernel that can run the binaries.

That is a different proposition from traditional unikernels. Traditional unikernels require you to port the application to a unikernel library. Hyperlight’s unikraft backend packages a Linux rootfs into a unikernel, so the developer does not have to port. The result is a micro-VM that can run the same Python or Node code that would otherwise run in a container, with a hypervisor boundary around it.

The gap between process sandboxes and VMs

The sandbox spectrum is a trade-off between isolation, compatibility, and startup time. At one end, a process sandbox using seccomp, namespaces, and cgroups is fast and compatible with ordinary Linux binaries, but it shares the host kernel. A kernel bug or a misconfigured seccomp profile can turn a sandbox into a privilege-escalation path. At the other end, a full VM with a separate kernel is strongly isolated, but it takes hundreds of milliseconds to seconds to boot, and it carries the overhead of a virtual machine monitor.

WebAssembly sits in the middle. It is fast to start, portable, and capability-based, but it requires the code to compile to Wasm. For Rust, C, and Go, that is often fine. For Python with native extensions, Java with a large runtime, or .NET with JIT, it is harder. The ecosystem has made progress, but compatibility is still a barrier.

Hyperlight’s bet is that a micro-VM can be fast enough to compete with process sandboxes while providing a stronger isolation boundary. The key techniques are a library VMM, no emulated devices, and snapshot/restore. The library VMM removes the separate process and the device model. The snapshot/restore removes the boot cost. The result is a micro-VM that starts in milliseconds, not seconds.

The trade-off is that the guest is minimal. There is no emulated NIC, no emulated disk, and no device tree full of virtual hardware. The host provides only the capabilities the guest needs. That reduces the attack surface, but it also means the guest cannot do everything a normal Linux system can do. The application has to fit the model.

A VMM as a library

The library design is the most interesting architectural choice. QEMU and Firecracker are separate processes. The host application talks to them over a socket or an API. Hyperlight is a library that the host application links into its own address space. The host creates a micro-VM, loads the guest, runs it, and reads the result, all through function calls.

That design has advantages. It removes the IPC overhead and the separate process lifecycle. It lets the host control the guest’s memory and capabilities directly. It makes the micro-VM feel like a function call rather than a service. It also simplifies deployment: there is no VMM daemon to manage, no socket to secure, and no separate version to patch.

It also has risks. A bug in the VMM is a bug in the host process. The host must trust the library, the hypervisor interface, and the guest’s memory safety. The isolation boundary is the hypervisor, not the process. That is a stronger boundary than a process sandbox, but it is not a guarantee against every attack. The host’s capability allow-list is the second line of defense.

Hyperlight supports Linux with KVM/MSHV, Windows with the Windows Hypervisor Platform, and macOS with Hypervisor.framework. It has Rust core SDKs plus Python and .NET SDKs. The host application can be written in Rust, Python, or .NET, and the guest can run a different language. That flexibility is important for AI agent runtimes, where the host is often Python and the untrusted code is also Python, but the sandbox needs to be isolated.

The no-emulated-devices design is a deliberate reduction. A virtual NIC and a virtual disk are convenient, but they are also attack surface. Hyperlight’s guest gets a minimal environment, and the host exposes filesystem, network, and other resources through explicit capabilities. That is closer to a capability-based security model than a traditional VM. It is also more work for the application developer, who has to declare what the guest can access.

Unmodified Linux binaries in a unikernel

The unikraft backend is the practical breakthrough. A traditional unikernel is a single-address-space image that runs one application. It is small and fast, but it requires the application to be compiled against the unikernel’s libraries. That is a barrier for Python, Node, Java, and .NET, which expect a Linux userspace.

Hyperlight’s hluk CLI takes a base rootfs and a Dockerfile-like build, and produces a unikernel that can run the rootfs’s binaries. The blog says it supports Python, Node.js, .NET (JIT and Native AOT), Java, PHP, Go, Rust, C, Bash, and PowerShell. It supports pip, npm, and the .NET SDK inside the guest, so packages can be installed at build time. The Python rootfs is about 14 MB.

That is a pragmatic use of unikernel technology. The unikernel provides the kernel and the minimal device model; the rootfs provides the language runtime and the application. The developer does not have to port the application. The result is a micro-VM that can run the same code as a container, with a smaller image and a faster start.

The compatibility is not universal. A Python package with a native extension needs a build for the guest’s architecture and libc. A Java application that expects a full Linux environment may hit missing syscalls or files. A .NET application that uses JIT needs the JIT to work inside the unikernel. The blog demonstrates these runtimes, but every application is different. The right way to read the claim is “unmodified binaries for supported runtimes,” not “every Linux program.”

The rootfs model also has operational implications. You build a rootfs, snapshot it, and restore it. That is similar to a container image plus a warm pool, but the build pipeline is new. You need to manage the rootfs, the snapshot, and the version of hluk. The 14 MB Python rootfs is small, but a rootfs with a full data-science stack is larger. The snapshot includes the initialized runtime, so the memory footprint is larger than the rootfs.

The 3 ms snapshot and what it measures

The benchmark is the headline. On an 8-vCPU Azure VM with KVM and nested virtualization, using hluk 0.20.1 in November 2026, the blog reports:

  • Python hello world: 22 ms vs 17 ms native.
  • Node.js hello world: 39 ms vs 22 ms native.
  • C# Roslyn compile: 95 ms vs 1,549 ms native.
  • Python numpy/pandas/scikit-learn import and run: 45 ms vs 1,119 ms native.
  • Eight micro-VMs sharing one Python snapshot: about 850 calls per second.

The “faster than native” numbers look impossible until you read what they measure. The native C# Roslyn and Python data-science runs include process startup, runtime initialization, and imports. The micro-VM restores a snapshot that has already paid those costs. The comparison is startup-inclusive, not steady-state. For a short-lived workload, that is the right comparison. For a long-running service, it is irrelevant.

The 3 ms restore is the number that matters for per-invocation sandboxes. The first run boots the unikernel and saves a snapshot. The second run restores the snapshot in about 3 ms. The snapshot is warm: the runtime is initialized, the imports are loaded, and the memory is in a known state. The guest then runs the request and exits. The host can restore the same snapshot for many requests, or create a pool of micro-VMs.

The benchmark uses nested virtualization, which is slower than bare metal. The blog presents the numbers as indicative, not as a formal benchmark suite. A busy host, a larger rootfs, or a different workload will change the results. The 850 calls per second for eight micro-VMs is a concurrency measurement, not a per-VM latency measurement. The right way to read it is as evidence that the model works, not as a capacity plan.

The Wasmtime escape demo

The security demo is the most compelling part of the post. Hyperlight can run Wasmtime inside the unikernel, which means a Wasm sandbox runs inside a hypervisor boundary. The blog demonstrates a known Wasmtime escape, CVE-2023-26489. When the exploit runs natively, it reads host secrets. When it runs inside Hyperlight, it can only see the micro-VM’s memory. The inner sandbox is broken, but the outer boundary holds.

That is the right way to think about defense in depth. No sandbox is perfect. A Wasm runtime can have a bug. A container can have a kernel exploit. A micro-VM can have a hypervisor bug. The question is what happens when the inner layer fails. If the answer is “the attacker gets the host,” the design is fragile. If the answer is “the attacker gets a minimal guest with no secrets,” the design is resilient.

The demo is not a formal security proof. It shows one exploit in one configuration. It does not cover side channels, snapshot integrity, or hypervisor bugs. It does not prove that Hyperlight is unbreakable. It does prove that the architecture can contain a real escape, which is more than most sandbox demos do.

The capability model is the other half of the security story. The guest does not get a NIC or a disk by default. The host grants access to specific resources. That is a deny-by-default model, and it limits the blast radius of a compromise. The guest can still be malicious, but it cannot reach what the host does not expose. The host must be careful about what it exposes, which is the hard part of any capability system.

Where this fits: agents, UDFs, and Kubernetes

The most obvious use case is AI agent code execution. Agents generate code, and that code is untrusted. It is often Python, it needs packages, and it runs for milliseconds to seconds. A container per call is too slow and too heavy. A process sandbox is too weak. A Wasm sandbox is too restrictive for Python with native extensions. A micro-VM with a prebuilt rootfs and a 3 ms restore is a better fit.

The integrations reflect that. smolagents-hyperlight sandboxes Hugging Face smolagents. mcp-server-hyperlight provides an MCP server for agent tool execution. openai-agents-hyperlight integrates with the OpenAI Agents SDK. agent-sandbox provides a Kubernetes agent sandbox. verl-hyperlight sandboxes verl RL training. The common pattern is untrusted code that needs a real language runtime and a strong boundary.

The ClickHouse integration is a concrete production use case beyond agents. clickhouse-hyperlight provides a CREATE FUNCTION ENGINE=HyperlightPython function, which runs Python UDFs in a micro-VM. That isolates the UDF from the database process. A buggy or malicious UDF cannot read the database’s memory or files. The same pattern applies to other databases and plugin systems.

The Kubernetes integration is urunc, an OCI runtime for containerd that uses a RuntimeClass. That puts Hyperlight in the same category as gVisor and Kata Containers: a sandboxed runtime class for pods that need stronger isolation. The difference is the library VMM and the unikernel backend. The operational model is familiar: a RuntimeClass, a pod spec, and a node-level runtime. The maturity is earlier: CNCF Sandbox, not graduated.

The caveats: maturity, security, and operations

Hyperlight is a CNCF Sandbox project. Sandbox is the earliest maturity stage. It is not a guarantee of production readiness. The project needs security audits, a stable API, and production users. The blog is written by the maintainers, and the benchmark is a maintainer benchmark. That does not make it wrong, but it is not independent validation.

The security model has open questions. The blog demonstrates containment of one Wasmtime escape. It does not cover side-channel attacks, snapshot integrity, hypervisor vulnerabilities, or the security of the host’s capability layer. A micro-VM is a strong boundary, but it is not a formal proof. Teams that run hostile code should assume the guest can be compromised and design the host accordingly.

The operational model is new. You build a rootfs, snapshot it, and restore it. That is not the same as building a container image and running it. The snapshot includes the initialized runtime, so it has state. You need to manage snapshot versions, rootfs updates, and compatibility between the two. You need to monitor the host’s memory and the micro-VM pool. You need to debug a guest that may not have a shell.

The compatibility is not universal. The blog supports Python, Node, .NET, Java, PHP, Go, Rust, C, Bash, and PowerShell, but each runtime has its own quirks. A Python package with a native extension needs a build for the guest. A Java application may need a full Linux environment. A .NET application may need JIT support. The right way to evaluate it is to test your workload, not to assume the demo generalizes.

The performance is workload-dependent. The 3 ms restore is for a warm snapshot. A cold boot is slower. A large rootfs is slower. A busy host is slower. The “faster than native” numbers are startup-inclusive. For a long-running service, the micro-VM adds overhead without adding value. For a short-lived, untrusted workload, the trade-off is attractive.

The broader bet

Hyperlight’s bet is that the sandbox market needs a fourth option: not a process, not a container, not a Wasm module, but a micro-VM that is fast enough to be invisible. The library VMM, the no-emulated-devices design, the unikernel backend, and the snapshot/restore are all in service of that bet. The AI agent use case gives it a reason to exist. The ClickHouse UDF and Kubernetes runtime integrations give it a path to production.

The bet may be right. The industry is moving toward executing more untrusted code: agents, plugins, UDFs, edge functions, and multi-tenant workloads. The sandbox needs to be strong, fast, and compatible. Hyperlight is not the only project chasing that combination, but it is one of the few that runs unmodified Linux binaries behind a hypervisor. That is a meaningful niche.

The bet may also be early. CNCF Sandbox projects often take years to mature. The security audits, the stable API, and the production users are ahead. The operational model is new. The compatibility is partial. The benchmark is a maintainer benchmark. The project is promising, but it is not a drop-in replacement for containers or VMs.

The right way to read the announcement is as a technical milestone, not a product launch. Hyperlight has shown that a library VMM can run unmodified Linux binaries in a micro-VM, restore a warm snapshot in about 3 ms, and contain a real Wasmtime escape. That is a strong foundation. The next step is the unglamorous work of audits, tooling, and production hardening. The sandbox gap is real. Hyperlight is one of the projects trying to fill it.

The bottom line

Hyperlight is a promising answer to a real gap: a micro-VM that is fast enough for per-invocation sandboxes and compatible enough to run ordinary Linux binaries. The library VMM, the unikernel backend, and the 3 ms snapshot are real technical achievements. The caveats are equally real: CNCF Sandbox maturity, a maintainer benchmark, and an operational model that is still new. It is worth watching, and worth piloting for untrusted code.

Sources


← back to posts