Repository navigation
vmem: Add support for lazily zero-initialized memory regions - #1873
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Snapshot compatibility, upper-half address decoding, and AArch64 instruction-fault handling need correction.
Review effort: Balanced
Findings: 1
Open (3)
What changed in this PR
Adds lazy zero-initialized memory regions to Hyperlight’s virtual-memory system for hyperlight-wasm.
Changes:
- Defines ZeroInit mappings and their page-table encodings.
- Extends guest fault handlers to allocate pages on demand.
- Preserves untouched lazy regions in snapshots without storing page contents.
| File | Description |
|---|---|
src/hyperlight_host/src/sandbox/snapshot/mod.rs |
Preserves untouched ZeroInit mappings. |
src/hyperlight_host/src/mem/mgr.rs |
Converts ZeroInit permissions to region flags. |
src/hyperlight_guest_bin/src/arch/amd64/exception/handle.rs |
Handles lazy-page allocation on AMD64. |
src/hyperlight_guest_bin/src/arch/aarch64/exception/handle.rs |
Handles lazy-page allocation on AArch64. |
src/hyperlight_common/src/vmem.rs |
Defines ZeroInit and makes mappings copyable. |
src/hyperlight_common/src/arch/amd64/vmem.rs |
Encodes and decodes AMD64 lazy mappings. |
src/hyperlight_common/src/arch/aarch64/vmem.rs |
Encodes and decodes AArch64 lazy mappings. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This comment has been minimized.
This comment has been minimized.
This is useful for hyperlight-wasm, although it can't fully provide for all use cases in a uniform way until we have better support for hugepages. Signed-off-by: Lucy Menon <168595099+syntactically@users.noreply.github.com>
bf7521b to
187f419
Compare
Benchmark ResultsMeasured commit: kvm / amd (Linux) (➖ stable)No benchmark improved or regressed. Benchmark Resultsfunction_call_codec
payload_allocation
sandboxes
slot_pool
snapshot_files
virtq_readonly
virtq_readwrite
kvm / intel (Linux) (➖ stable)No benchmark improved or regressed. Benchmark Resultsfunction_call_codec
payload_allocation
sandboxes
slot_pool
snapshot_files
virtq_readonly
virtq_readwrite
mshv3 / amd (Linux) (➖ stable)No benchmark improved or regressed. Benchmark Resultsfunction_call_codec
payload_allocation
sandboxes
slot_pool
snapshot_files
virtq_readonly
virtq_readwrite
mshv3 / intel (Linux) (➖ stable)No benchmark improved or regressed. Benchmark Resultsfunction_call_codec
payload_allocation
sandboxes
slot_pool
snapshot_files
virtq_readonly
virtq_readwrite
hyperv-ws2025 / amd (Windows) (➖ stable)No benchmark improved or regressed. Benchmark Resultsfunction_call_codec
payload_allocation
sandboxes
slot_pool
snapshot_files
virtq_readonly
virtq_readwrite
hyperv-ws2025 / intel (Windows) (➖ stable)No benchmark improved or regressed. Benchmark Resultsfunction_call_codec
payload_allocation
sandboxes
slot_pool
snapshot_files
virtq_readonly
virtq_readwrite
Reported by |


This is useful for hyperlight-wasm, although it can't fully provide for all use cases in a uniform way until we have better support for hugepages.