-
Notifications
You must be signed in to change notification settings - Fork 29
Add zerocopy mapping for wasm binary #102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
be10373
to
68bd34b
Compare
Rebased on main & updated some comments. |
There was a problem hiding this 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.
dc4a36f
to
9621011
Compare
There was a problem hiding this 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>
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.