Skip to content

Conversation

syntactically
Copy link
Member

This predominantly adds support for using the features from hyperlight-dev/hyperlight#696 to zerocopy map a wasm binary into the guest. Since this requires being able to modify guest page tables anyway, it also does the first pieces of setting up virtual memory in wasmtime, enough to get a view towards performance/etc. There is a major missing piece in that wasmtime_mprotect is not properly implemented, which means that wasm can escape to the guest relatively easily; I will make an issue to track getting that fixed.

@syntactically
Copy link
Member Author

Rebased on main & updated some comments.

Copy link
Contributor

@jprendes jprendes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, I love the benchmark results! :-)
I left some comments, if there's a reason to rush merging these changes I'm happy to defer them to a different PR.

@syntactically syntactically force-pushed the lm/vm branch 4 times, most recently from dc4a36f to 9621011 Compare July 10, 2025 00:18
jprendes
jprendes previously approved these changes Jul 10, 2025
Copy link
Contributor

@jprendes jprendes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank @syntactically!
I learned a lot reviewing this and the corresponding hyperlight core PR!

LGTM :-)

The core hyperlight libraries now have both version and git keys in
Cargo.toml, allowing us to develop against upstream hyperlight HEAD.

Signed-off-by: Lucy Menon <168595099+syntactically@users.noreply.github.com>
This makes wasmtime_init_traps actually register an exception handler,
and adds handling for #UD to recognize it as a trap that should be
forwraded to wasmtime.  More traps will need to be added in the future
in order to ensure correctness.

Signed-off-by: Lucy Menon <168595099+syntactically@users.noreply.github.com>
This adds support for directly mapping a host buffer containing a wasm
module/component into the guest, enabling the use of mmap() on the host
to share a single module/component across multiple sandboxes.

Signed-off-by: Lucy Menon <168595099+syntactically@users.noreply.github.com>
There is a big caveat here, which is that wasmtime's mprotect calls are
ignored, so this sandbox is very unsound: a wasm module can take over
the entire guest easily

Signed-off-by: Lucy Menon <168595099+syntactically@users.noreply.github.com>
@syntactically syntactically merged commit 2a168d1 into main Jul 10, 2025
25 checks passed
@syntactically syntactically deleted the lm/vm branch July 10, 2025 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants