From 8b40213fc17a9f99e8465c20240dddaf5f0e0a88 Mon Sep 17 00:00:00 2001
From: Lucy Menon <168595099+syntactically@users.noreply.github.com>
Date: Tue, 8 Jul 2025 11:38:19 +0000
Subject: [PATCH 1/4] Add git dependencies on hyperlight for development
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>
---
Cargo.lock | 103 ++++++++++++++++++++-------
Cargo.toml | 2 +-
src/hyperlight_wasm/Cargo.toml | 2 +-
src/hyperlight_wasm_macro/Cargo.lock | 2 -
src/hyperlight_wasm_macro/Cargo.toml | 2 +-
src/wasm_runtime/Cargo.lock | 12 ++--
src/wasm_runtime/Cargo.toml | 6 +-
7 files changed, 87 insertions(+), 42 deletions(-)
diff --git a/Cargo.lock b/Cargo.lock
index d4ee440..1b6b5ec 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -322,6 +322,22 @@ dependencies = [
"serde",
]
+[[package]]
+name = "cargo-util-schemas"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e63d2780ac94487eb9f1fea7b0d56300abc9eb488800854ca217f102f5caccca"
+dependencies = [
+ "semver",
+ "serde",
+ "serde-untagged",
+ "serde-value",
+ "thiserror 1.0.69",
+ "toml 0.8.23",
+ "unicode-xid",
+ "url",
+]
+
[[package]]
name = "cargo_metadata"
version = "0.19.2"
@@ -687,19 +703,6 @@ dependencies = [
"itertools 0.10.5",
]
-[[package]]
-name = "crossbeam"
-version = "0.8.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1137cd7e7fc0fb5d3c5a8678be38ec56e819125d8d7907411fe24ccb943faca8"
-dependencies = [
- "crossbeam-channel",
- "crossbeam-deque",
- "crossbeam-epoch",
- "crossbeam-queue",
- "crossbeam-utils",
-]
-
[[package]]
name = "crossbeam-channel"
version = "0.5.15"
@@ -1249,8 +1252,7 @@ dependencies = [
[[package]]
name = "hyperlight-common"
version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c6b9232222e023b84c7c10bdb67327f503567a1a5ff68db935683af0147d73ba"
+source = "git+https://github.com/hyperlight-dev/hyperlight?rev=ea6fa8f#ea6fa8f16dae2325d94af39eb6ac3b441b24dcac"
dependencies = [
"anyhow",
"flatbuffers",
@@ -1262,8 +1264,7 @@ dependencies = [
[[package]]
name = "hyperlight-component-macro"
version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9bc0fc7f0d77ab2c16277da4efb58fa99c56f607f9407fd5c0490909c327facd"
+source = "git+https://github.com/hyperlight-dev/hyperlight?rev=ea6fa8f#ea6fa8f16dae2325d94af39eb6ac3b441b24dcac"
dependencies = [
"env_logger",
"hyperlight-component-util",
@@ -1278,8 +1279,7 @@ dependencies = [
[[package]]
name = "hyperlight-component-util"
version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "88137b20c4761f4b309d36b22574e2283745afad5959df7ecc5928557417d098"
+source = "git+https://github.com/hyperlight-dev/hyperlight?rev=ea6fa8f#ea6fa8f16dae2325d94af39eb6ac3b441b24dcac"
dependencies = [
"itertools 0.14.0",
"log",
@@ -1293,15 +1293,13 @@ dependencies = [
[[package]]
name = "hyperlight-host"
version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1cb5d2db5c1325df0c1042680ccbff16958105a2842140736ac463d67df89fba"
+source = "git+https://github.com/hyperlight-dev/hyperlight?rev=ea6fa8f#ea6fa8f16dae2325d94af39eb6ac3b441b24dcac"
dependencies = [
"anyhow",
"bitflags 2.9.1",
"cfg-if",
"cfg_aliases",
"chrono",
- "crossbeam",
"crossbeam-channel",
"elfcore",
"flatbuffers",
@@ -1331,7 +1329,7 @@ dependencies = [
"vmm-sys-util",
"windows",
"windows-result",
- "windows-sys 0.59.0",
+ "windows-sys 0.60.2",
"windows-version",
]
@@ -1358,7 +1356,7 @@ dependencies = [
"once_cell",
"page_size",
"tar",
- "toml",
+ "toml 0.9.0",
"tracing",
"windows",
]
@@ -2620,6 +2618,15 @@ dependencies = [
"serde",
]
+[[package]]
+name = "serde_spanned"
+version = "0.6.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3"
+dependencies = [
+ "serde",
+]
+
[[package]]
name = "serde_spanned"
version = "1.0.0"
@@ -2875,6 +2882,18 @@ dependencies = [
"tokio",
]
+[[package]]
+name = "toml"
+version = "0.8.23"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362"
+dependencies = [
+ "serde",
+ "serde_spanned 0.6.9",
+ "toml_datetime 0.6.11",
+ "toml_edit",
+]
+
[[package]]
name = "toml"
version = "0.9.0"
@@ -2883,13 +2902,22 @@ checksum = "f271e09bde39ab52250160a67e88577e0559ad77e9085de6e9051a2c4353f8f8"
dependencies = [
"indexmap",
"serde",
- "serde_spanned",
- "toml_datetime",
+ "serde_spanned 1.0.0",
+ "toml_datetime 0.7.0",
"toml_parser",
"toml_writer",
"winnow",
]
+[[package]]
+name = "toml_datetime"
+version = "0.6.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c"
+dependencies = [
+ "serde",
+]
+
[[package]]
name = "toml_datetime"
version = "0.7.0"
@@ -2899,6 +2927,20 @@ dependencies = [
"serde",
]
+[[package]]
+name = "toml_edit"
+version = "0.22.27"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a"
+dependencies = [
+ "indexmap",
+ "serde",
+ "serde_spanned 0.6.9",
+ "toml_datetime 0.6.11",
+ "toml_write",
+ "winnow",
+]
+
[[package]]
name = "toml_parser"
version = "1.0.0"
@@ -2908,6 +2950,12 @@ dependencies = [
"winnow",
]
+[[package]]
+name = "toml_write"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801"
+
[[package]]
name = "toml_writer"
version = "1.0.0"
@@ -3747,6 +3795,9 @@ name = "winnow"
version = "0.7.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74c7b26e3480b707944fc872477815d29a8e429d2f93a1ce000f5fa84a15cbcd"
+dependencies = [
+ "memchr",
+]
[[package]]
name = "wit-bindgen-rt"
diff --git a/Cargo.toml b/Cargo.toml
index 633f05f..f7f662b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,4 +13,4 @@ repository = "https://github.com/hyperlight-dev/hyperlight-wasm"
readme = "README.md"
[workspace.dependencies]
-hyperlight-host = { version = "0.7.0", default-features = false, features = ["executable_heap", "init-paging"] }
+hyperlight-host = { version = "0.7.0", git = "https://github.com/hyperlight-dev/hyperlight", rev = "ea6fa8f", default-features = false, features = ["executable_heap", "init-paging"] }
diff --git a/src/hyperlight_wasm/Cargo.toml b/src/hyperlight_wasm/Cargo.toml
index 14c142f..96e988d 100644
--- a/src/hyperlight_wasm/Cargo.toml
+++ b/src/hyperlight_wasm/Cargo.toml
@@ -58,7 +58,7 @@ windows = { version = "0.61", features = ["Win32_System_Threading"] }
page_size = "0.6.0"
[dev-dependencies]
-hyperlight-component-macro = "0.7.0"
+hyperlight-component-macro = { version = "0.7.0", git = "https://github.com/hyperlight-dev/hyperlight", rev = "ea6fa8f" }
examples_common = { path = "../examples_common" }
criterion = { version = "0.6.0", features = ["html_reports"] }
crossbeam-queue = "0.3"
diff --git a/src/hyperlight_wasm_macro/Cargo.lock b/src/hyperlight_wasm_macro/Cargo.lock
index 3d2934b..2ad9117 100644
--- a/src/hyperlight_wasm_macro/Cargo.lock
+++ b/src/hyperlight_wasm_macro/Cargo.lock
@@ -39,8 +39,6 @@ dependencies = [
[[package]]
name = "hyperlight-component-util"
version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "88137b20c4761f4b309d36b22574e2283745afad5959df7ecc5928557417d098"
dependencies = [
"itertools",
"log",
diff --git a/src/hyperlight_wasm_macro/Cargo.toml b/src/hyperlight_wasm_macro/Cargo.toml
index 275eab5..bb9eb05 100644
--- a/src/hyperlight_wasm_macro/Cargo.toml
+++ b/src/hyperlight_wasm_macro/Cargo.toml
@@ -17,4 +17,4 @@ proc-macro2 = { version = "1.0.93" }
syn = { version = "2.0.96" }
itertools = { version = "0.14.0" }
prettyplease = { version = "0.2.31" }
-hyperlight-component-util = { version = "0.7.0" }
+hyperlight-component-util = { version = "0.7.0", git = "https://github.com/hyperlight-dev/hyperlight", rev = "ea6fa8f" }
diff --git a/src/wasm_runtime/Cargo.lock b/src/wasm_runtime/Cargo.lock
index b5739be..a80dd4a 100644
--- a/src/wasm_runtime/Cargo.lock
+++ b/src/wasm_runtime/Cargo.lock
@@ -601,8 +601,7 @@ dependencies = [
[[package]]
name = "hyperlight-common"
version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c6b9232222e023b84c7c10bdb67327f503567a1a5ff68db935683af0147d73ba"
+source = "git+https://github.com/hyperlight-dev/hyperlight?rev=ea6fa8f#ea6fa8f16dae2325d94af39eb6ac3b441b24dcac"
dependencies = [
"anyhow",
"flatbuffers",
@@ -613,8 +612,7 @@ dependencies = [
[[package]]
name = "hyperlight-component-util"
version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "88137b20c4761f4b309d36b22574e2283745afad5959df7ecc5928557417d098"
+source = "git+https://github.com/hyperlight-dev/hyperlight?rev=ea6fa8f#ea6fa8f16dae2325d94af39eb6ac3b441b24dcac"
dependencies = [
"itertools",
"log",
@@ -628,8 +626,7 @@ dependencies = [
[[package]]
name = "hyperlight-guest"
version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9e9f007acee89f791a645acd7ae517190bd2bd2e4e24ede531e8d9b70c898c65"
+source = "git+https://github.com/hyperlight-dev/hyperlight?rev=ea6fa8f#ea6fa8f16dae2325d94af39eb6ac3b441b24dcac"
dependencies = [
"anyhow",
"hyperlight-common",
@@ -639,8 +636,7 @@ dependencies = [
[[package]]
name = "hyperlight-guest-bin"
version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4e125eb8b36a7f8909c8efea4e37ebb5306307fc3e20a0d2b533a40441785e34"
+source = "git+https://github.com/hyperlight-dev/hyperlight?rev=ea6fa8f#ea6fa8f16dae2325d94af39eb6ac3b441b24dcac"
dependencies = [
"buddy_system_allocator",
"cc",
diff --git a/src/wasm_runtime/Cargo.toml b/src/wasm_runtime/Cargo.toml
index 2346ab9..a45bd2e 100644
--- a/src/wasm_runtime/Cargo.toml
+++ b/src/wasm_runtime/Cargo.toml
@@ -11,9 +11,9 @@ doctest = false
bench = false
[dependencies]
-hyperlight-common = { version = "0.7.0", default-features = false }
-hyperlight-guest-bin = { version = "0.7.0", features = [ "printf" ] }
-hyperlight-guest = { version = "0.7.0" }
+hyperlight-common = { version = "0.7.0", git = "https://github.com/hyperlight-dev/hyperlight", rev = "ea6fa8f", default-features = false }
+hyperlight-guest-bin = { version = "0.7.0", git = "https://github.com/hyperlight-dev/hyperlight", rev = "ea6fa8f", features = [ "printf" ] }
+hyperlight-guest = { version = "0.7.0", git = "https://github.com/hyperlight-dev/hyperlight", rev = "ea6fa8f" }
wasmtime = { version = "34.0.1", default-features = false, features = [ "runtime", "custom-virtual-memory", "custom-native-signals", "component-model" ] }
hyperlight-wasm-macro = { path = "../hyperlight_wasm_macro" }
spin = "0.9.8"
From 917a1da3e9e34191ffe4cdc711ecdbfcc5766603 Mon Sep 17 00:00:00 2001
From: Lucy Menon <168595099+syntactically@users.noreply.github.com>
Date: Tue, 8 Jul 2025 11:45:06 +0000
Subject: [PATCH 2/4] wasmtime platform: make init_traps catch #UD
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>
---
src/wasm_runtime/src/component.rs | 4 +++
src/wasm_runtime/src/module.rs | 4 ++-
src/wasm_runtime/src/platform.rs | 50 +++++++++++++++++++++++++++++--
3 files changed, 54 insertions(+), 4 deletions(-)
diff --git a/src/wasm_runtime/src/component.rs b/src/wasm_runtime/src/component.rs
index 7fa5dff..0d01c47 100644
--- a/src/wasm_runtime/src/component.rs
+++ b/src/wasm_runtime/src/component.rs
@@ -33,6 +33,8 @@ use spin::Mutex;
use wasmtime::component::{Component, Instance, Linker};
use wasmtime::{Config, Engine, Store};
+use crate::platform;
+
static CUR_ENGINE: Mutex