Skip to content

Blog

Announcing Hyperlight 0.19.0

Hyperlight is a lightweight Virtual Machine Manager (VMM) designed to be embedded directly in applications. It enables safe execution of untrusted code with low latency and minimal overhead.

Hyperlight 0.19.0 has been released! This release includes significantly faster snapshots, enables memory reuse between snapshots, lets you resize scratch memory on snapshot, and changes the way guest heaps are laid out. To view the full list of changes, please see the 0.19.0 changelog.

Snapshots in this release have gotten a significant speed-up. In some cases latency has been reduced by as much as 99% (171 ms → 1.7 ms). Here are our benchmark results targeting both MSHV on Linux 6.6 and KVM on Linux 6.17:

BenchmarkMSHVKVM
snapshots/create/default440 µs → 249 µs (−43%)380 µs → 262 µs (−31%)
snapshots/create/large171 ms → 1.68 ms (−99%)162 ms → 1.7 ms (−99%)
snapshots/call_and_create/medium38.1 ms → 726 µs (−98%)35 ms → 778 µs (−98%)
snapshots/restore_alternate/large4.41 ms → 106 µs (−98%)1.66 ms → 131 µs (−92%)
snapshots/restore/large1.2 ms → 91.6 µs (−92%)403 µs → 52 µs (−87%)

Snapshots can now share memory between multiple layers using copy-on-write semantics. This can greatly reduce memory usage when working with guests that have a relatively big immutable part that is loaded as part of every guest. For example: JavaScript workloads on Hyperlight now only have to pay the memory cost for loading the JS runtime once, even if the workloads themselves are different.

In Hyperlight snapshots form a tree. You can restore an earlier snapshot and take a new one to create a separate branch. Here is an example in Rust, where first and second share memory with root but not with each other:

// Our root snapshot
let mut sandbox = ...;
let root = sandbox.snapshot()?;
// The first snapshot (branch 1)
sandbox.call::<i32>("MyValue", 42)?;
let first = sandbox.snapshot()?;
// The second snapshot (branch 2)
sandbox.restore(root)?;
sandbox.call::<i32>("MyValue", 100)?;
let second = sandbox.snapshot()?;

One caveat with layered snapshots is that layers are immutable, and so data in a previous layer remains accessible in later snapshots. This requires extra care when snapshots involve secrets: if a secret was snapshotted as part of one layer, it will remain accessible by the guest even if it was subsequently zeroed.

Resize scratch memory when taking a snapshot

Section titled “Resize scratch memory when taking a snapshot”

A guest may need more memory during initialization than it needs during the remainder of the program operation. Hyperlight now lets you give these stages different scratch sizes using SnapshotOptions. This is for example the case with many interpreted languages, which consume more memory during the initial interpretation:

use hyperlight_host::SandboxBuilder;
use hyperlight_host::sandbox::snapshot::SnapshotOptions;
// Create a sandbox which boots with 8MiB of scratch.
let mut sandbox = SandboxBuilder::from_file("guest.bin")
.scratch_size(8 * 1024 * 1024)
.build()?;
// ... Perform initialization work here.
// Snapshot the sandbox, resizing scratch to 2MiB.
let options = SnapshotOptions::default().scratch_size(2 * 1024 * 1024);
let snapshot = sandbox.snapshot_with_options(&options)?;

You can now also inspect how much scratch the guest has allocated using Sandbox::scratch_allocated_bytes. It reports allocations since the last snapshot or restore. Though note that this value is guest-controlled, and should be used for diagnostics only.

Guest heap is now backed by scratch memory

Section titled “Guest heap is now backed by scratch memory”

Heap memory in the guest is now backed by the scratch region, providing a single value to control. As a result of this change snapshots no longer contain a zero-filled heap region, making them smaller and faster to create and load. As well as making heap operations on the guest faster.

As the heap size now uses scratch memory, this may require a larger scratch size. As part of this change we’ve removed all heap_size controls, making scratch_size the only way to control heap size:

// before (0.18)
let sandbox = SandboxBuilder::from_file(guest_path)
.heap_size(1024 * 1024)
.scratch_size(4 * 1024 * 1024)
.build()?;
// after (0.19)
let sandbox = SandboxBuilder::from_file(guest_path)
.scratch_size(5 * 1024 * 1024) // heap now draws from scratch
.build()?;

Announcing Hyperlight 0.18.0

Hyperlight is a lightweight Virtual Machine Manager (VMM) designed to be embedded directly in applications. It enables safe execution of untrusted code with low latency and minimal overhead.

Hyperlight 0.18.0 has been released! This release changes how the host and guest communicate, adds support for ARM64 Windows, application-specific snapshot metadata, portable exception handlers, and more. To view the full list of changes, please see the 0.18.0 changelog.

Ring-based communication between guests and hosts

Section titled “Ring-based communication between guests and hosts”

The guest and host in Hyperlight now communicate using two internal ring buffers, modeled after the virtio virtqueue specification. These ring buffers serves as the foundation for future improvements to Hyperlight, including non-blocking (async) RPC calls and streams.

Hyperlight 0.18.0 does not change the user-facing API yet. Upgrading from 0.17.0 to 0.18.0 should be relatively straightforward for that reason. What is new however is that we’re exposing controls to configure the queue sizes from both the guest→host, and host→guest.

let mut sandbox = SandboxBuilder::from_file(guest_path)
.g2h_queue_size(128)
.h2g_queue_size(64)
.build()?;

While these changes do not affect the public API, debug builds now do require more stack space in this release. We now reserve 48 KiB for the guest exception stack and its metadata, up from 8 KiB. We expect to optimize this and lower it again in a future release.

This has by far been one of the biggest changes we’ve made to Hyperlight to date, and its importance cannot be overstated. Among other things this feature is what enables us to begin implementing WASI 0.3 support in hyperlight-wasm. You can read more about the design in HIP 0001: Ring Buffer and Virtqueue communication guide in the docs.

Hyperlight now supports ARM64 Windows through the Windows Hypervisor Platform (WHP) API. This is a continuation of the work we’ve done in Hyperlight 0.17.0, which added support for ARM64 on macOS.

We want Hyperlight to work on as many platforms as possible, and supporting ARM64 Windows is in line with that. Though it may not be the most popular server platform, it is an increasingly popular consumer platform, and that too benefits from being able to run ultra-light sandboxes.

The MultiUseSandbox API is now the Sandbox API

Section titled “The MultiUseSandbox API is now the Sandbox API”

In the last release we introduced a new builder API by introducing a new SandboxBuilder API. In this release we’re continuing our ergonomics improvements by renaming MultiUseSandbox to become Sandbox. That means that once you call SandboxBuilder::build you get an instance of Sandbox.

To help users upgrade, we’re keeping MultiUseSandbox as an alias for one release, after which we will be removing it and keeping Sandbox as the only API.

// before
let sandbox: MultiUseSandbox = SandboxBuilder::from_file(...).build()?;
// after
let sandbox: Sandbox = SandboxBuilder::from_file(...).build()?;

Attach application-specific metadata to snapshots

Section titled “Attach application-specific metadata to snapshots”

Snapshots can now store additional app-specific metadata with namespaces. Adding metadata returns a new snapshot and leaves the original unchanged:

// Define metadata for the snapshot
#[derive(Serialize, Deserialize)]
struct SnapshotMetadata {
version: u32,
}
// Create a snapshot
let snapshot = snapshot.with_metadata("my-app", &SnapshotMetadata { version: 1 })?;
// Get the metadata from the snapshot
let metadata = snapshot
.metadata::<SnapshotMetadata>("my-app")?
.expect("metadata should exist");

Guests can now install portable exception handling hooks, deprecating the previous x64-specific hyperlight_guest_bin::exception::arch API. Exception handlers can be registered using the hyperlight_guest_bin::exception submodule. This currently exposes handlers for page faults and for undefined instructions, which we may extend with more handlers in the future.

In Rust, handlers are encoded as extern "C" functions that are registered in the guest. When a fault occurs, this function is invoked so it can handle it. However it can’t return, and must either longjmp or panic.

use hyperlight_guest_bin::exception::register_page_fault_handler;
extern "C" fn on_page_fault(rip: u64, frame_pointer: u64, address: u64) -> ! {
panic!("page fault at {address:#x} (rip {rip:#x}, fp {frame_pointer:#x})");
}
register_page_fault_handler(on_page_fault);

Announcing Hyperlight 0.17.0

Hyperlight is a lightweight Virtual Machine Manager (VMM) designed to be embedded directly in applications. It enables safe execution of untrusted code with low latency and minimal overhead.

Hyperlight 0.17.0 has been released! This release introduces macOS support for Hyperlight, a new SandboxBuilder API, better component bindgen, and security improvements.

Hyperlight now runs on Apple Silicon using Apple’s Hypervisor.framework API. This makes macOS the third major platform for Hyperlight, following Linux and Windows. All Apple Silicon CPU families are supported (M1 and later).

macOS support is however currently more limited than on our other platforms. On macOS we map multiple sandboxes to a single VM in the host process, swapping them out as needed. This means losing out on parallelism, and in turn results in worse performance than on our other targets. But on the upside it does mean we can support even the oldest Apple Silicon CPUs (M1 + M2).

We do plan to eventually optimize performance for Apple M3 and later, which should be able to achieve performance similar to our other supported platforms. But as a starting point we figured we should prioritize compatibility over performance, since macOS is used more for development than for deployment.

Constructing sandboxes is now more ergonomic thanks to the SandboxBuilder API. Setting up a sandbox used to require mutating a SandboxConfiguration, using that to construct an UninitializedSandbox, and then calling the evolve method to obtain a final MultiUseSandbox:

let mut config = SandboxConfiguration::default();
config.set_heap_size(256 * 1024);
let guest = GuestBinary::FilePath(guest_path);
let mut sandbox = UninitializedSandbox::new(guest, Some(config))?;
sandbox.register("Add", |a: i32, b: i32| a + b)?;
let mut sandbox: MultiUseSandbox = sandbox.evolve()?;
assert_eq!(sandbox.call("Add", (7, 8))?, 15);

With the new builder API, all these steps become a single chained call:

let mut sandbox = SandboxBuilder::from_file(guest_path)
.heap_size(256 * 1024)
.host_function("Add", |a: i32, b: i32| Ok(a + b))
.build()?;
assert_eq!(sandbox.call("Add", (7, 8))?, 15);

Improvements to the component bindgen macro

Section titled “Improvements to the component bindgen macro”

The hyperlight_component_macro crate generates the glue between the Hyperlight guest and the host. In this release we’ve made some updates to that system, most notably: guest calls on the host side now return a Result. This makes it possible to gracefully handle cases where something went wrong while calling into the guest, where previously the host would panic.

Hyperlight macros can now also operate directly on WIT IDL files. Doing this is as easy as pointing the host_bindgen! macro at a .wit file, which will then be parsed and expanded into a typed interface for the host:

// A single WIT file
hyperlight_component_macro::host_bindgen!(wit: "wit/world.wit");

Guest MSR state no longer leaks between restore calls

Section titled “Guest MSR state no longer leaks between restore calls”

Model-Specific Register (MSR) state used to be able to persist in guests between calls to MultiUseSandbox::restore. After almost a year of work, we have finally fixed this problem, and guest MSR state no longer leaks between restores.

Guest MSR state is now part of the snapshot state instead, which can be declared up-front when constructing a sandbox. You can do this either by using SandboxConfiguration::guest_msrs, or with the newer SandboxBuilder::guest_msrs API.

let mut sandbox = SandboxBuilder::from_file(guest_path)
.guest_msrs(&[0x174, 0x175, 0x176])? // ← SYSENTER CS, ESP, EIP
.build()?;

Read more about this in our docs: MSR state across restore.

Check out everything that changed in Hyperlight.

Upcoming Talk: Running Wasmtime in Hardware-Isolated Microenvironments

At WasmCon, co-located with KubeCon + CloudNativeCon Europe 2026 in Amsterdam on March 23, Danilo (Dan) Chiarlone from Microsoft will present on running the Wasmtime WebAssembly runtime inside Hyperlight’s hardware-isolated micro-VMs. This talk will explore how combining Wasmtime with Hyperlight provides dual-layer security — a WebAssembly software sandbox inside a hypervisor-enforced VM boundary — while maintaining fast cold starts.

The recording is now available! Watch the talk on YouTube.

Upcoming Talk: Even More Hoops — Debugging WebAssembly across the Hardware Memory Partition Boundary

At Wasm I/O 2026 in Barcelona on March 19, Doru Blânzeanu will present on the challenges and solutions for debugging WebAssembly code running inside Hyperlight’s hardware-isolated micro-VMs. Building on Hyperlight’s GDB/LLDB debugging support, this talk will explore how to step through Wasm execution across the hardware memory partition boundary that separates the guest VM from the host.

View the session and add it to your calendar