From cc9a35075076d912bee5e46c5010a3c750649185 Mon Sep 17 00:00:00 2001 From: Mark Rossett Date: Tue, 22 Jul 2025 13:09:55 -0700 Subject: [PATCH 1/6] Updating hyperlight-wasm crate features so mshv3 is the default (instead of mshv2) Signed-off-by: Mark Rossett --- .github/workflows/Benchmarks.yml | 2 +- .github/workflows/dep_rust.yml | 10 +++++----- Justfile | 8 ++++---- src/hyperlight_wasm/Cargo.toml | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/Benchmarks.yml b/.github/workflows/Benchmarks.yml index dceed11..9b0d538 100644 --- a/.github/workflows/Benchmarks.yml +++ b/.github/workflows/Benchmarks.yml @@ -71,7 +71,7 @@ jobs: # the component model benchmark depends on the wasm wit component just ensure-tools just compile-wit - just bench-ci dev release ${{ matrix.hypervisor == 'mshv3' && 'mshv3' || ''}} + just bench-ci dev release ${{ matrix.hypervisor == 'mshv' && 'mshv2' || ''}} working-directory: ./src/hyperlight_wasm - name: Upload Benchmarks diff --git a/.github/workflows/dep_rust.yml b/.github/workflows/dep_rust.yml index 926bc28..163a558 100644 --- a/.github/workflows/dep_rust.yml +++ b/.github/workflows/dep_rust.yml @@ -92,7 +92,7 @@ jobs: run: just clippy ${{ matrix.config }} - name: Build - run: just build ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv3' && 'mshv3' || ''}} + run: just build ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv' && 'mshv2' || ''}} working-directory: ./src/hyperlight_wasm - name: Build Rust Wasm examples @@ -100,7 +100,7 @@ jobs: working-directory: ./src/hyperlight_wasm - name: Test - run: just test ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv3' && 'mshv3' || ''}} + run: just test ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv' && 'mshv2' || ''}} working-directory: ./src/hyperlight_wasm - name: Install github-cli (Windows) @@ -118,14 +118,14 @@ jobs: shell: pwsh - name: Test Examples - run: just examples-ci ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv3' && 'mshv3' || ''}} + run: just examples-ci ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv' && 'mshv2' || ''}} working-directory: ./src/hyperlight_wasm env: # required for gh cli when downloading GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Test Component Model Examples - run: just examples-components ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv3' && 'mshv3' || ''}} + run: just examples-components ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv' && 'mshv2' || ''}} working-directory: ./src/hyperlight_wasm ### Benchmarks ### @@ -141,6 +141,6 @@ jobs: - name: Run benchmarks run: | - just bench-ci dev ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv3' && 'mshv3' || ''}} + just bench-ci dev ${{ matrix.config }} ${{ matrix.hypervisor == 'mshv' && 'mshv2' || ''}} working-directory: ./src/hyperlight_wasm if: ${{ matrix.config == 'release' }} diff --git a/Justfile b/Justfile index 5cc4e74..e4bcd50 100644 --- a/Justfile +++ b/Justfile @@ -89,16 +89,16 @@ test target=default-target features="": (test-seccomp target features) cargo test test_metrics {{ if features =="" {''} else if features=="no-default-features" {"--no-default-features" } else {"--no-default-features -F " + features } }} --profile={{ if target == "debug" {"dev"} else { target } }} -- --ignored test-seccomp target=default-target features="": - cargo test {{ if features =="" {'--no-default-features -F "kvm,mshv2,seccomp"'} else {"--no-default-features -F seccomp," + features } }} --profile={{ if target == "debug" {"dev"} else { target } }} -- --test-threads=1 - cargo test {{ if features =="" {'--no-default-features -F "kvm,mshv2,seccomp"'} else {"--no-default-features -F seccomp," + features } }} test_metrics --profile={{ if target == "debug" {"dev"} else { target } }} -- --ignored --test-threads=1 - cargo test {{ if features =="" {'--no-default-features -F "kvm,mshv2,seccomp"'} else {"--no-default-features -F seccomp," + features } }} test_gather_metrics --profile={{ if target == "debug" {"dev"} else { target } }} -- --ignored --test-threads=1 + cargo test {{ if features =="" {'--no-default-features -F "kvm,mshv3,seccomp"'} else {"--no-default-features -F seccomp," + features } }} --profile={{ if target == "debug" {"dev"} else { target } }} -- --test-threads=1 + cargo test {{ if features =="" {'--no-default-features -F "kvm,mshv3,seccomp"'} else {"--no-default-features -F seccomp," + features } }} test_metrics --profile={{ if target == "debug" {"dev"} else { target } }} -- --ignored --test-threads=1 + cargo test {{ if features =="" {'--no-default-features -F "kvm,mshv3,seccomp"'} else {"--no-default-features -F seccomp," + features } }} test_gather_metrics --profile={{ if target == "debug" {"dev"} else { target } }} -- --ignored --test-threads=1 examples-ci target=default-target features="": (build-rust-wasm-examples target) cargo run {{ if features =="" {''} else {"--no-default-features -F " + features } }} --profile={{ if target == "debug" {"dev"} else { target } }} --example helloworld cargo run {{ if features =="" {''} else {"--no-default-features -F " + features } }} --profile={{ if target == "debug" {"dev"} else { target } }} --example hostfuncs cargo run {{ if features =="" {''} else {"--no-default-features -F " + features } }} --profile={{ if target == "debug" {"dev"} else { target } }} --example rust_wasm_examples cargo run {{ if features =="" {''} else {"--no-default-features -F function_call_metrics," + features } }} --profile={{ if target == "debug" {"dev"} else { target } }} --example metrics - cargo run {{ if features =="" {"--no-default-features --features kvm,mshv2"} else {"--no-default-features -F function_call_metrics," + features } }} --profile={{ if target == "debug" {"dev"} else { target } }} --example metrics + cargo run {{ if features =="" {"--no-default-features --features kvm,mshv3"} else {"--no-default-features -F function_call_metrics," + features } }} --profile={{ if target == "debug" {"dev"} else { target } }} --example metrics examples-components target=default-target features="": (build-rust-component-examples target) {{ wit-world }} cargo run {{ if features =="" {''} else {"--no-default-features -F " + features } }} --profile={{ if target == "debug" {"dev"} else { target } }} --example component_example diff --git a/src/hyperlight_wasm/Cargo.toml b/src/hyperlight_wasm/Cargo.toml index e7a22b3..f507748 100644 --- a/src/hyperlight_wasm/Cargo.toml +++ b/src/hyperlight_wasm/Cargo.toml @@ -76,7 +76,7 @@ goblin = "0.10.0" tar = "0.4.44" [features] -default = ["function_call_metrics", "kvm", "mshv2"] +default = ["function_call_metrics", "kvm", "mshv3"] function_call_metrics = ["hyperlight-host/function_call_metrics"] seccomp = ["hyperlight-host/seccomp"] print_debug = ["hyperlight-host/print_debug"] From 19f771eb18c9f814644f32f50defe1caec397c80 Mon Sep 17 00:00:00 2001 From: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com> Date: Thu, 24 Jul 2025 19:49:17 -0700 Subject: [PATCH 2/6] update hyperlight dependencies to 172fcfa Update all hyperlight dependencies from various revisions to a unified 172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1 snapshot that includes snapshot/restore functionality. Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com> --- Cargo.lock | 21 +++- 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 | 142 ++++++++++++++++----------- src/wasm_runtime/Cargo.toml | 6 +- 7 files changed, 106 insertions(+), 71 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9a65acf..b948f4d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1263,7 +1263,7 @@ dependencies = [ [[package]] name = "hyperlight-common" version = "0.7.0" -source = "git+https://github.com/hyperlight-dev/hyperlight?rev=ea6fa8f#ea6fa8f16dae2325d94af39eb6ac3b441b24dcac" +source = "git+https://github.com/hyperlight-dev/hyperlight?rev=172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1#172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1" dependencies = [ "anyhow", "flatbuffers", @@ -1275,7 +1275,7 @@ dependencies = [ [[package]] name = "hyperlight-component-macro" version = "0.7.0" -source = "git+https://github.com/hyperlight-dev/hyperlight?rev=b61265e4aa9e2ecf8d648b994022caeea0205352#b61265e4aa9e2ecf8d648b994022caeea0205352" +source = "git+https://github.com/hyperlight-dev/hyperlight?rev=172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1#172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1" dependencies = [ "env_logger", "hyperlight-component-util", @@ -1290,7 +1290,7 @@ dependencies = [ [[package]] name = "hyperlight-component-util" version = "0.7.0" -source = "git+https://github.com/hyperlight-dev/hyperlight?rev=b61265e4aa9e2ecf8d648b994022caeea0205352#b61265e4aa9e2ecf8d648b994022caeea0205352" +source = "git+https://github.com/hyperlight-dev/hyperlight?rev=172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1#172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1" dependencies = [ "itertools 0.14.0", "log", @@ -1304,10 +1304,11 @@ dependencies = [ [[package]] name = "hyperlight-host" version = "0.7.0" -source = "git+https://github.com/hyperlight-dev/hyperlight?rev=ea6fa8f#ea6fa8f16dae2325d94af39eb6ac3b441b24dcac" +source = "git+https://github.com/hyperlight-dev/hyperlight?rev=172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1#172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1" dependencies = [ "anyhow", "bitflags 2.9.1", + "blake3", "cfg-if", "cfg_aliases", "chrono", @@ -1337,6 +1338,7 @@ dependencies = [ "tracing", "tracing-core", "tracing-log", + "uuid", "vmm-sys-util", "windows", "windows-result", @@ -3113,6 +3115,17 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" +[[package]] +name = "uuid" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cf4199d1e5d15ddd86a694e4d0dffa9c323ce759fea589f00fef9d81cc1931d" +dependencies = [ + "getrandom 0.3.3", + "js-sys", + "wasm-bindgen", +] + [[package]] name = "valuable" version = "0.1.1" diff --git a/Cargo.toml b/Cargo.toml index f7f662b..62cf1a2 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", git = "https://github.com/hyperlight-dev/hyperlight", rev = "ea6fa8f", default-features = false, features = ["executable_heap", "init-paging"] } +hyperlight-host = { version = "0.7.0", git = "https://github.com/hyperlight-dev/hyperlight", rev = "172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1", default-features = false, features = ["executable_heap", "init-paging"] } diff --git a/src/hyperlight_wasm/Cargo.toml b/src/hyperlight_wasm/Cargo.toml index f507748..46e96ac 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 = { version = "0.7.0", git = "https://github.com/hyperlight-dev/hyperlight", rev = "b61265e4aa9e2ecf8d648b994022caeea0205352" } +hyperlight-component-macro = { version = "0.7.0", git = "https://github.com/hyperlight-dev/hyperlight", rev = "172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1" } 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 3b01b24..03e9b44 100644 --- a/src/hyperlight_wasm_macro/Cargo.lock +++ b/src/hyperlight_wasm_macro/Cargo.lock @@ -39,7 +39,7 @@ dependencies = [ [[package]] name = "hyperlight-component-util" version = "0.7.0" -source = "git+https://github.com/hyperlight-dev/hyperlight?rev=b61265e4aa9e2ecf8d648b994022caeea0205352#b61265e4aa9e2ecf8d648b994022caeea0205352" +source = "git+https://github.com/hyperlight-dev/hyperlight?rev=172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1#172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1" dependencies = [ "itertools", "log", diff --git a/src/hyperlight_wasm_macro/Cargo.toml b/src/hyperlight_wasm_macro/Cargo.toml index 3c2a2fc..516ffae 100644 --- a/src/hyperlight_wasm_macro/Cargo.toml +++ b/src/hyperlight_wasm_macro/Cargo.toml @@ -16,4 +16,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", git = "https://github.com/hyperlight-dev/hyperlight", rev = "b61265e4aa9e2ecf8d648b994022caeea0205352" } +hyperlight-component-util = { version = "0.7.0", git = "https://github.com/hyperlight-dev/hyperlight", rev = "172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1" } diff --git a/src/wasm_runtime/Cargo.lock b/src/wasm_runtime/Cargo.lock index c48991f..9e189ba 100644 --- a/src/wasm_runtime/Cargo.lock +++ b/src/wasm_runtime/Cargo.lock @@ -153,36 +153,36 @@ checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" [[package]] name = "cranelift-assembler-x64" -version = "0.121.1" +version = "0.121.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "226b7077389885873ffad5d778e8512742580a6e11b0f723072f41f305d3652f" +checksum = "2ce81edaca6167d1f78da026afa92d7ff957a80aa82a79076e11cd34cde20165" dependencies = [ "cranelift-assembler-x64-meta", ] [[package]] name = "cranelift-assembler-x64-meta" -version = "0.121.1" +version = "0.121.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9cfeae5a23c8cf9c43381f49211f3ce6dc1da1d46f1c5d06966e6258cc483fa" +checksum = "4d0d51e12f958551165969c6e8767e1e461729f6c1ccae923b0ba1d5cbcbbbf8" dependencies = [ "cranelift-srcgen", ] [[package]] name = "cranelift-bforest" -version = "0.121.1" +version = "0.121.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c88c577c6af92b550cb83455c331cf8e1bc89fe0ccc3e7eb0fa617ed1d63056" +checksum = "41294c755094d2c8a514cea903039742474423f2e91601332eab5f4094f76333" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-bitset" -version = "0.121.1" +version = "0.121.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "370f0aa7f1816bf0f838048d69b72d6cf12ef2fc3b37f6997fe494ffb9feb3ad" +checksum = "ebb6f5d0df5bd0d02c63ec48e8f2e38a176b123f59e084f22caf89a0d0593e7e" dependencies = [ "serde", "serde_derive", @@ -190,9 +190,9 @@ dependencies = [ [[package]] name = "cranelift-codegen" -version = "0.121.1" +version = "0.121.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d1a10a8a2958b68ecd261e565eef285249e242a8447ac959978319eabbb4a55" +checksum = "e543cdb278b7c15f739021cf880ee1808c68fa2402febb87edb9307f552c8fec" dependencies = [ "bumpalo", "cranelift-assembler-x64", @@ -217,9 +217,9 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" -version = "0.121.1" +version = "0.121.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f319986d5ae1386cfec625c70f8c01e52dc1f910aa6aaee7740bf8842d4e19c7" +checksum = "f979c75cfd712dbc754799dfe4a4d0db7a51defc2e36d006b27a8a63e018eece" dependencies = [ "cranelift-assembler-x64-meta", "cranelift-codegen-shared", @@ -229,24 +229,24 @@ dependencies = [ [[package]] name = "cranelift-codegen-shared" -version = "0.121.1" +version = "0.121.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed52f5660397039c3c741c3acf18746445f4e20629b7280d9f2ccfe57e2b1efd" +checksum = "d2f36e74ba4033490587a47952f74390cb7d4f1fc1fa28ace50564e491f1e38f" [[package]] name = "cranelift-control" -version = "0.121.1" +version = "0.121.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79bde8d48e1840702574e28c5d7d4499441435af71e6c47450881f84ce2b60a5" +checksum = "f6671962c7d65b9a7ad038cd92da6784744d8a9ecf8ded8bb9a1f7046dbe2ccf" dependencies = [ "arbitrary", ] [[package]] name = "cranelift-entity" -version = "0.121.1" +version = "0.121.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0335ac187211ac94c254826b6e78d23b8654ae09ebf0830506a827a2647162f" +checksum = "ee832f8329fa87c5df6c1d64a8506a58031e6f8a190d9b21b1900272a4dbb47d" dependencies = [ "cranelift-bitset", "serde", @@ -255,9 +255,9 @@ dependencies = [ [[package]] name = "cranelift-frontend" -version = "0.121.1" +version = "0.121.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4fce5fcf93c1fece95d0175b15fbaf0808b187430bc06c8ecde80db0ed58c5e" +checksum = "4f7bc17aa3277214eab4b63a03544b1b46962154012b751c9f14c2a5419c6471" dependencies = [ "cranelift-codegen", "log", @@ -267,15 +267,15 @@ dependencies = [ [[package]] name = "cranelift-isle" -version = "0.121.1" +version = "0.121.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13fc8d838a2bf28438dbaf6ccdbc34531b6a972054f43fd23be7f124121ce6e0" +checksum = "cff02dcecae2e7e9c61b713f1fb46eabecdca9f55b49f99859ceb1a3e7f4a9cb" [[package]] name = "cranelift-native" -version = "0.121.1" +version = "0.121.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0975ce66adcf2e0729d06b1d3efea0398d793d1f39c2e0a6f52a347537836693" +checksum = "90f76fd681f35bdf17be9c3e516b9acc0c7bd61b81faf95496decd8e0000979c" dependencies = [ "cranelift-codegen", "libc", @@ -284,9 +284,9 @@ dependencies = [ [[package]] name = "cranelift-srcgen" -version = "0.121.1" +version = "0.121.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4493a9b500bb02837ea2fb7d4b58c1c21c37a470ae33c92659f4e637aad14c9" +checksum = "8c3d9071bc5ee5573e723d9d84a45b7025a29e8f2c5ad81b3b9d0293129541d9" [[package]] name = "crc32fast" @@ -601,7 +601,7 @@ dependencies = [ [[package]] name = "hyperlight-common" version = "0.7.0" -source = "git+https://github.com/hyperlight-dev/hyperlight?rev=ea6fa8f#ea6fa8f16dae2325d94af39eb6ac3b441b24dcac" +source = "git+https://github.com/hyperlight-dev/hyperlight?rev=172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1#172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1" dependencies = [ "anyhow", "flatbuffers", @@ -612,7 +612,7 @@ dependencies = [ [[package]] name = "hyperlight-component-util" version = "0.7.0" -source = "git+https://github.com/hyperlight-dev/hyperlight?rev=b61265e4aa9e2ecf8d648b994022caeea0205352#b61265e4aa9e2ecf8d648b994022caeea0205352" +source = "git+https://github.com/hyperlight-dev/hyperlight?rev=172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1#172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1" dependencies = [ "itertools", "log", @@ -626,17 +626,18 @@ dependencies = [ [[package]] name = "hyperlight-guest" version = "0.7.0" -source = "git+https://github.com/hyperlight-dev/hyperlight?rev=ea6fa8f#ea6fa8f16dae2325d94af39eb6ac3b441b24dcac" +source = "git+https://github.com/hyperlight-dev/hyperlight?rev=172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1#172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1" dependencies = [ "anyhow", "hyperlight-common", + "hyperlight-guest-tracing-macro", "serde_json", ] [[package]] name = "hyperlight-guest-bin" version = "0.7.0" -source = "git+https://github.com/hyperlight-dev/hyperlight?rev=ea6fa8f#ea6fa8f16dae2325d94af39eb6ac3b441b24dcac" +source = "git+https://github.com/hyperlight-dev/hyperlight?rev=172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1#172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1" dependencies = [ "buddy_system_allocator", "cc", @@ -644,10 +645,31 @@ dependencies = [ "glob", "hyperlight-common", "hyperlight-guest", + "hyperlight-guest-tracing-macro", "log", "spin 0.10.0", ] +[[package]] +name = "hyperlight-guest-tracing" +version = "0.7.0" +source = "git+https://github.com/hyperlight-dev/hyperlight?rev=172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1#172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1" +dependencies = [ + "hyperlight-common", + "spin 0.10.0", +] + +[[package]] +name = "hyperlight-guest-tracing-macro" +version = "0.7.0" +source = "git+https://github.com/hyperlight-dev/hyperlight?rev=172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1#172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1" +dependencies = [ + "hyperlight-guest-tracing", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "hyperlight-wasm-macro" version = "0.7.0" @@ -1023,9 +1045,9 @@ dependencies = [ [[package]] name = "pulley-interpreter" -version = "34.0.1" +version = "34.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe0e8f39bc99694ce6fc8df7df7ed258d38d255a9268e2ff964f67f4a6588cdb" +checksum = "be14280b69a9cbb6ada02a7aa5f7b3f1b72d1043b5bc9336990b700525dea6e3" dependencies = [ "cranelift-bitset", "log", @@ -1035,9 +1057,9 @@ dependencies = [ [[package]] name = "pulley-macros" -version = "34.0.1" +version = "34.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9276d404009cc49f3b8befeb8ffc1d868c5ea732bd9d72ab3e64231187f908c5" +checksum = "076f1be746801280af4c96c4407b5fd1d09cfa53ab27ba0ac7dd8f207e7bbf83" dependencies = [ "proc-macro2", "quote", @@ -1809,9 +1831,9 @@ dependencies = [ [[package]] name = "wasmtime" -version = "34.0.1" +version = "34.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2523d3347356a74e9c312c2c96e709c82d998dcafdca97f6d620e69c032fd043" +checksum = "ec10e50038f22ab407fdd8708120b8feed3450a02618efcf26ca47e82122927d" dependencies = [ "anyhow", "bitflags", @@ -1851,18 +1873,18 @@ dependencies = [ [[package]] name = "wasmtime-asm-macros" -version = "34.0.1" +version = "34.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c45ecc343d3ad4629d5882e94f3b0f0fac22a043c07e64373381168ae00c259" +checksum = "4d379cda46d6fd18619e282a75fbb09b70b3d0f166b605f45b4059dfaf9dc6ce" dependencies = [ "cfg-if", ] [[package]] name = "wasmtime-component-macro" -version = "34.0.1" +version = "34.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3491c0f2511be561a92ac9b086351abc3a0f48c5f5f7d14f3975e246c13838be" +checksum = "6b08be093e0a876da45f79070c2ada4656f2785eb77c01b86ce60be3153920a5" dependencies = [ "anyhow", "proc-macro2", @@ -1875,15 +1897,15 @@ dependencies = [ [[package]] name = "wasmtime-component-util" -version = "34.0.1" +version = "34.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26bc084e249f74e61c79077d8937c34fb0af223752b9b1725e3d7ed94b006f23" +checksum = "f0451ce0dd94a33d0dbd57934ce666a04c2753a5262ca2bc84cf6a67cf5303dc" [[package]] name = "wasmtime-cranelift" -version = "34.0.1" +version = "34.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0010bd93362c634837e6bb13e213c2d83673b28dc12208b64ddd821fa55f7d33" +checksum = "15aa836683d7398f13f2f26bbe74c404ceaba66b6bbb96700d6b7f91bec90e03" dependencies = [ "anyhow", "cfg-if", @@ -1908,9 +1930,9 @@ dependencies = [ [[package]] name = "wasmtime-environ" -version = "34.0.1" +version = "34.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36a035dc308ff6be3d790dafdc2e41a128415e20ad864580da49470073e21dc1" +checksum = "317081a0cbbb1f749d348b262575608fc082d47ab11b6247bbe9163eeb955777" dependencies = [ "anyhow", "cranelift-bitset", @@ -1933,9 +1955,9 @@ dependencies = [ [[package]] name = "wasmtime-jit-icache-coherence" -version = "34.0.1" +version = "34.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44c71d64e8ebe132cd45e9d299a4d0daf261d66bd05cf50a204a1bf8cf96ff1f" +checksum = "8ea6b740d1a35f2cebfe88e013ac8a4a84ff8dabc3a392df920abf554e871cf2" dependencies = [ "anyhow", "cfg-if", @@ -1945,24 +1967,24 @@ dependencies = [ [[package]] name = "wasmtime-math" -version = "34.0.1" +version = "34.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "222bfa4769c6931c985711eb49a92748ea0acc4ca85fcd24e945a2f1bacda0c1" +checksum = "62fa317691aedc64aae3a86b3d786e4b2b0007bc0b56e0b6098b8b5a85ab2134" dependencies = [ "libm", ] [[package]] name = "wasmtime-slab" -version = "34.0.1" +version = "34.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ac42c7fb0639f7c3e0c1ed0c984050245c55410f3fae334dd5b102e0edfab14" +checksum = "60a06819d24370273021054b50589e3078e7f5cfac15515e58b3fbbebf5e5b39" [[package]] name = "wasmtime-versioned-export-macros" -version = "34.0.1" +version = "34.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e052e1d9c30b8f31aff64380caaaff492a9890a412658bcc8866fe626b8e91f" +checksum = "9ca100ed168ffc9b37aefc07a5be440645eab612a2ff6e2ff884e8cc3740e666" dependencies = [ "proc-macro2", "quote", @@ -1971,9 +1993,9 @@ dependencies = [ [[package]] name = "wasmtime-winch" -version = "34.0.1" +version = "34.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2d71e002033124221f6633a462c26067280519fdd7527ba2751f585db779cc6" +checksum = "595f51430606a7b5578f34e0d7c73dca52a22ed24756f2ba9d4d0c1bde8631af" dependencies = [ "anyhow", "cranelift-codegen", @@ -1988,9 +2010,9 @@ dependencies = [ [[package]] name = "wasmtime-wit-bindgen" -version = "34.0.1" +version = "34.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f967f5efaaac7694e6bd0d67542a5a036830860e4adf95684260181e85a5d299" +checksum = "233fdcb96f9097be697319ba647ef42bdbdb40e89f04c8ae3713103813b5b793" dependencies = [ "anyhow", "heck", @@ -2038,9 +2060,9 @@ dependencies = [ [[package]] name = "winch-codegen" -version = "34.0.1" +version = "34.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d2bf456780101aff8950642fdf984f182816d7f555d5375699200242be78762" +checksum = "cdf007d7940f62127ce4f33a8aa92dadedfdc78c3860a057e06c8c24e26e180d" dependencies = [ "anyhow", "cranelift-assembler-x64", diff --git a/src/wasm_runtime/Cargo.toml b/src/wasm_runtime/Cargo.toml index 51d6e40..10ca96a 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", 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" } +hyperlight-common = { version = "0.7.0", git = "https://github.com/hyperlight-dev/hyperlight", rev = "172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1", default-features = false } +hyperlight-guest-bin = { version = "0.7.0", git = "https://github.com/hyperlight-dev/hyperlight", rev = "172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1", features = [ "printf" ] } +hyperlight-guest = { version = "0.7.0", git = "https://github.com/hyperlight-dev/hyperlight", rev = "172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1" } wasmtime = { version = "34.0.2", 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 66b47e7565a0e8e92353c29c20b1b15d2c819bbc Mon Sep 17 00:00:00 2001 From: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com> Date: Thu, 24 Jul 2025 19:52:28 -0700 Subject: [PATCH 3/6] [host] migrate to snapshot-based sandbox API Replace transition-based sandbox evolution with direct snapshot/restore API: - Remove EvolvableSandbox/DevolvableSandbox trait usage - Replace transition callbacks with direct method calls - Add snapshot/restore methods to LoadedWasmSandbox - Store initial snapshots in WasmSandbox for efficient unloading - Export Snapshot type in public API This provides more direct control over sandbox state management and enables features like checkpoint/restore. Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com> --- src/hyperlight_wasm/src/lib.rs | 2 + .../src/sandbox/loaded_wasm_sandbox.rs | 74 ++++++--- src/hyperlight_wasm/src/sandbox/metrics.rs | 24 ++- .../src/sandbox/proto_wasm_sandbox.rs | 35 ++-- .../src/sandbox/wasm_sandbox.rs | 155 ++++++++++-------- 5 files changed, 172 insertions(+), 118 deletions(-) diff --git a/src/hyperlight_wasm/src/lib.rs b/src/hyperlight_wasm/src/lib.rs index f974da6..4a022e6 100644 --- a/src/hyperlight_wasm/src/lib.rs +++ b/src/hyperlight_wasm/src/lib.rs @@ -39,6 +39,8 @@ pub type Result = hyperlight_host::Result; pub use hyperlight_host::is_hypervisor_present; /// Create a generic HyperlightError pub use hyperlight_host::new_error; +// A snapshot of the memory of a sandbox at a given point in time. +pub use hyperlight_host::sandbox::snapshot::Snapshot; /// Get the build information for this version of hyperlight-wasm pub fn get_build_info() -> BuildInfo { diff --git a/src/hyperlight_wasm/src/sandbox/loaded_wasm_sandbox.rs b/src/hyperlight_wasm/src/sandbox/loaded_wasm_sandbox.rs index b90c62c..27e848f 100644 --- a/src/hyperlight_wasm/src/sandbox/loaded_wasm_sandbox.rs +++ b/src/hyperlight_wasm/src/sandbox/loaded_wasm_sandbox.rs @@ -14,14 +14,14 @@ See the License for the specific language governing permissions and limitations under the License. */ +use std::fmt::Debug; use std::sync::Arc; use hyperlight_host::func::{ParameterTuple, SupportedReturnType}; // re-export the InterruptHandle trait as it's part of the public API pub use hyperlight_host::hypervisor::InterruptHandle; use hyperlight_host::sandbox::Callable; -use hyperlight_host::sandbox_state::sandbox::{DevolvableSandbox, Sandbox}; -use hyperlight_host::sandbox_state::transition::Noop; +use hyperlight_host::sandbox::snapshot::Snapshot; use hyperlight_host::{MultiUseSandbox, Result, log_then_return, new_error}; use super::metrics::METRIC_TOTAL_LOADED_WASM_SANDBOXES; @@ -37,16 +37,15 @@ use crate::sandbox::metrics::{METRIC_ACTIVE_LOADED_WASM_SANDBOXES, METRIC_SANDBO /// memory context. If you want to "reset" the memory context, create /// a new `LoadedWasmSandbox` -- either from another `WasmSandbox` or by /// calling `my_loaded_wasm_sandbox.devolve()?.evolve()?` -#[derive(Debug)] pub struct LoadedWasmSandbox { // inner is an Option as we need to take ownership of it // We implement drop on the LoadedWasmSandbox to decrement the count of Sandboxes when it is dropped // because of this we cannot implement drop without making inner an Option (alternatively we could make MultiUseSandbox Copy but that would introduce other issues) inner: Option, + // The state the sandbox was in before loading a wasm module. Used for transitioning back to a `WasmSandbox` (unloading the wasm module). + runtime_snapshot: Option, } -impl Sandbox for LoadedWasmSandbox {} - impl LoadedWasmSandbox { /// Call the function in the guest with the name `fn_name`, passing /// parameters `params`. @@ -64,17 +63,50 @@ impl LoadedWasmSandbox { None => log_then_return!("No inner MultiUseSandbox to call_guest_function"), } } + + /// Take a snapshot of the current state of the sandbox. + pub fn snapshot(&mut self) -> Result { + match &mut self.inner { + Some(inner) => inner.snapshot(), + None => log_then_return!("No inner MultiUseSandbox to snapshot"), + } + } + + /// Restore the state of the sandbox to the state captured in the given snapshot. + pub fn restore(&mut self, snapshot: &Snapshot) -> Result<()> { + match &mut self.inner { + Some(inner) => inner.restore(snapshot), + None => log_then_return!("No inner MultiUseSandbox to restore"), + } + } + /// unload the wasm module and return a `WasmSandbox` that can be used to load another module - pub fn unload_module(self) -> Result { - self.devolve(Noop::default()).inspect(|_| { + pub fn unload_module(mut self) -> Result { + let sandbox = self + .inner + .take() + .ok_or_else(|| new_error!("No inner MultiUseSandbox to unload"))?; + + let snapshot = self + .runtime_snapshot + .take() + .ok_or_else(|| new_error!("No snapshot of the WasmSandbox to unload"))?; + + WasmSandbox::new_from_loaded(sandbox, snapshot).inspect(|_| { metrics::counter!(METRIC_SANDBOX_UNLOADS).increment(1); }) } - pub(super) fn new(inner: MultiUseSandbox) -> Result { + pub(super) fn new( + inner: MultiUseSandbox, + runtime_snapshot: Snapshot, + ) -> Result { metrics::gauge!(METRIC_ACTIVE_LOADED_WASM_SANDBOXES).increment(1); metrics::counter!(METRIC_TOTAL_LOADED_WASM_SANDBOXES).increment(1); - Ok(LoadedWasmSandbox { inner: Some(inner) }) + Ok(LoadedWasmSandbox { + inner: Some(inner), + runtime_snapshot: Some(runtime_snapshot), + }) } /// Get a handle to the interrupt handler for this sandbox, @@ -100,26 +132,20 @@ impl Callable for LoadedWasmSandbox { } } -/// Capability to transform a `LoadedWasmSandbox` back down to a -/// `WasmSandbox` -impl DevolvableSandbox> - for LoadedWasmSandbox -{ - fn devolve(mut self, _: Noop) -> Result { - let new_inner: MultiUseSandbox = match self.inner.take() { - Some(inner) => inner.devolve(Noop::default())?, - None => log_then_return!("No inner MultiUseSandbox to devolve"), - }; - Ok(WasmSandbox::new(new_inner)) - } -} - impl Drop for LoadedWasmSandbox { fn drop(&mut self) { metrics::gauge!(METRIC_ACTIVE_LOADED_WASM_SANDBOXES).decrement(1); } } +impl Debug for LoadedWasmSandbox { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("LoadedWasmSandbox") + .field("inner", &self.inner) + .finish() + } +} + #[cfg(test)] mod tests { use std::sync::Arc; @@ -161,7 +187,7 @@ mod tests { } .unwrap(); - call_funcs(loaded_wasm_sandbox, 1000); + call_funcs(loaded_wasm_sandbox, 500); } #[test] diff --git a/src/hyperlight_wasm/src/sandbox/metrics.rs b/src/hyperlight_wasm/src/sandbox/metrics.rs index 834a5a1..e19c658 100644 --- a/src/hyperlight_wasm/src/sandbox/metrics.rs +++ b/src/hyperlight_wasm/src/sandbox/metrics.rs @@ -35,8 +35,16 @@ pub(crate) static METRIC_SANDBOX_UNLOADS: &str = "sandbox_unloads_total"; #[cfg(test)] mod tests { use examples_common::get_wasm_module_path; + use hyperlight_host::HyperlightError; - use crate::{LoadedWasmSandbox, ProtoWasmSandbox}; + use crate::{LoadedWasmSandbox, ProtoWasmSandbox, Result}; + + fn get_time_since_boot_microsecond() -> Result { + let res = std::time::SystemTime::now() + .duration_since(std::time::SystemTime::UNIX_EPOCH)? + .as_micros(); + i64::try_from(res).map_err(HyperlightError::IntConversionFailure) + } #[test] #[ignore = "Needs to run separately to not get influenced by other tests"] @@ -46,7 +54,13 @@ mod tests { recorder.install().unwrap(); let snapshot = { - let sandbox = ProtoWasmSandbox::default(); + let mut sandbox = ProtoWasmSandbox::default(); + sandbox + .register( + "GetTimeSinceBootMicrosecond", + get_time_since_boot_microsecond, + ) + .unwrap(); let wasm_sandbox = sandbox.load_runtime().unwrap(); let loaded_wasm_sandbox: LoadedWasmSandbox = { @@ -57,6 +71,10 @@ mod tests { snapshotter.snapshot() }; let snapshot = snapshot.into_vec(); - assert_eq!(snapshot.len(), 8); + if cfg!(feature = "function_call_metrics") { + assert_eq!(snapshot.len(), 10); + } else { + assert_eq!(snapshot.len(), 8); + } } } diff --git a/src/hyperlight_wasm/src/sandbox/proto_wasm_sandbox.rs b/src/hyperlight_wasm/src/sandbox/proto_wasm_sandbox.rs index 551096c..5202e18 100644 --- a/src/hyperlight_wasm/src/sandbox/proto_wasm_sandbox.rs +++ b/src/hyperlight_wasm/src/sandbox/proto_wasm_sandbox.rs @@ -14,15 +14,11 @@ See the License for the specific language governing permissions and limitations under the License. */ -use hyperlight_host::func::call_ctx::MultiUseGuestCallContext; use hyperlight_host::func::{HostFunction, ParameterTuple, Registerable, SupportedReturnType}; -use hyperlight_host::sandbox::Callable; #[cfg(all(feature = "seccomp", target_os = "linux"))] use hyperlight_host::sandbox::ExtraAllowedSyscall; use hyperlight_host::sandbox::config::SandboxConfiguration; -use hyperlight_host::sandbox_state::sandbox::{EvolvableSandbox, Sandbox}; -use hyperlight_host::sandbox_state::transition::{MultiUseContextCallback, Noop}; -use hyperlight_host::{GuestBinary, MultiUseSandbox, Result, UninitializedSandbox, new_error}; +use hyperlight_host::{GuestBinary, Result, UninitializedSandbox, new_error}; use super::metrics::{METRIC_ACTIVE_PROTO_WASM_SANDBOXES, METRIC_TOTAL_PROTO_WASM_SANDBOXES}; use super::sandbox_builder::SandboxBuilder; @@ -39,8 +35,6 @@ pub struct ProtoWasmSandbox { pub(super) inner: Option, } -impl Sandbox for ProtoWasmSandbox {} - impl Registerable for ProtoWasmSandbox { fn register_host_function( &mut self, @@ -95,27 +89,20 @@ impl ProtoWasmSandbox { /// The returned `WasmSandbox` can be then be cached and used to load a different Wasm module. /// pub fn load_runtime(mut self) -> Result { - let multi_use_sandbox: MultiUseSandbox = match self.inner.take() { - Some(s) => s.evolve(Noop::default())?, + let mut sandbox = match self.inner.take() { + Some(s) => s.evolve()?, None => return Err(new_error!("No inner sandbox found.")), }; - let func = Box::new(move |call_ctx: &mut MultiUseGuestCallContext| { - let res: i32 = call_ctx.call("InitWasmRuntime", ())?; - if res != 0 { - return Err(new_error!( - "InitWasmRuntime Failed with error code {:?}", - res - )); - } - Ok(()) - }); - - let transition_func = MultiUseContextCallback::from(func); - - let new_sbox: MultiUseSandbox = multi_use_sandbox.evolve(transition_func)?; + let res: i32 = sandbox.call_guest_function_by_name("InitWasmRuntime", ())?; + if res != 0 { + return Err(new_error!( + "InitWasmRuntime Failed with error code {:?}", + res + )); + } - Ok(WasmSandbox::new(new_sbox)) + WasmSandbox::new(sandbox) } /// Register the given host function `host_func` with `self` under diff --git a/src/hyperlight_wasm/src/sandbox/wasm_sandbox.rs b/src/hyperlight_wasm/src/sandbox/wasm_sandbox.rs index ad382da..6898361 100644 --- a/src/hyperlight_wasm/src/sandbox/wasm_sandbox.rs +++ b/src/hyperlight_wasm/src/sandbox/wasm_sandbox.rs @@ -16,11 +16,9 @@ limitations under the License. use std::path::Path; -use hyperlight_host::func::call_ctx::MultiUseGuestCallContext; use hyperlight_host::mem::memory_region::{MemoryRegion, MemoryRegionFlags, MemoryRegionType}; use hyperlight_host::sandbox::Callable; -use hyperlight_host::sandbox_state::sandbox::{EvolvableSandbox, Sandbox}; -use hyperlight_host::sandbox_state::transition::MultiUseContextCallback; +use hyperlight_host::sandbox::snapshot::Snapshot; use hyperlight_host::{MultiUseSandbox, Result, new_error}; use super::loaded_wasm_sandbox::LoadedWasmSandbox; @@ -39,20 +37,39 @@ pub struct WasmSandbox { // We implement drop on the WasmSandbox to decrement the count of Sandboxes when it is dropped // because of this we cannot implement drop without making inner an Option (alternatively we could make MultiUseSandbox Copy but that would introduce other issues) inner: Option, + // Snapshot of state of an initial WasmSandbox (runtime loaded, but no guest module code loaded). + // Used for LoadedWasmSandbox to be able restore state back to WasmSandbox + snapshot: Option, } -impl Sandbox for WasmSandbox {} - const MAPPED_BINARY_VA: u64 = 0x1_0000_0000u64; impl WasmSandbox { /// Create a new WasmSandBox from a `MultiUseSandbox`. /// This function should be used to create a new `WasmSandbox` from a ProtoWasmSandbox. /// The difference between this function and creating a `WasmSandbox` directly is that /// this function will increment the metrics for the number of `WasmSandbox`es in the system. - pub(super) fn new(inner: MultiUseSandbox) -> Self { + pub(super) fn new(mut inner: MultiUseSandbox) -> Result { + let snapshot = inner.snapshot()?; + metrics::gauge!(METRIC_ACTIVE_WASM_SANDBOXES).increment(1); + metrics::counter!(METRIC_TOTAL_WASM_SANDBOXES).increment(1); + Ok(WasmSandbox { + inner: Some(inner), + snapshot: Some(snapshot), + }) + } + + /// Same as new, but doesn't take a new snapshot. Useful if `new` has already been called, + /// for example when creating a `WasmSandbox` from a `LoadedWasmSandbox`, since + /// the snapshot has already been created in that case. + /// Expects a snapshot of the state where wasm runtime is loaded, but no guest module code is loaded. + pub(super) fn new_from_loaded(mut loaded: MultiUseSandbox, snapshot: Snapshot) -> Result { + loaded.restore(&snapshot)?; metrics::gauge!(METRIC_ACTIVE_WASM_SANDBOXES).increment(1); metrics::counter!(METRIC_TOTAL_WASM_SANDBOXES).increment(1); - WasmSandbox { inner: Some(inner) } + Ok(WasmSandbox { + inner: Some(loaded), + snapshot: Some(snapshot), + }) } /// Load a Wasm module at the given path into the sandbox and return a `LoadedWasmSandbox` @@ -60,16 +77,20 @@ impl WasmSandbox { /// /// Before you can call guest functions in the sandbox, you must call /// this function and use the returned value to call guest functions. - pub fn load_module(self, file: impl AsRef) -> Result { - let func = Box::new(move |call_ctx: &mut MultiUseGuestCallContext| { - if let Ok(len) = call_ctx.map_file_cow(file.as_ref(), MAPPED_BINARY_VA) { - call_ctx.call("LoadWasmModulePhys", (MAPPED_BINARY_VA, len)) - } else { - let wasm_bytes = std::fs::read(file)?; - Self::load_module_from_buffer_transition_func(wasm_bytes)(call_ctx) - } - }); - self.load_module_inner(func) + pub fn load_module(mut self, file: impl AsRef) -> Result { + let inner = self + .inner + .as_mut() + .ok_or_else(|| new_error!("WasmSandbox is None"))?; + + if let Ok(len) = inner.map_file_cow(file.as_ref(), MAPPED_BINARY_VA) { + inner.call::<()>("LoadWasmModulePhys", (MAPPED_BINARY_VA, len))?; + } else { + let wasm_bytes = std::fs::read(file)?; + load_wasm_module_from_bytes(inner, wasm_bytes)?; + } + + self.finalize_module_load() } /// Load a Wasm module that is currently present in a buffer in @@ -84,45 +105,30 @@ impl WasmSandbox { /// of the region remains intact and is not written to until the /// produced LoadedWasmSandbox is discarded or devolved. pub unsafe fn load_module_by_mapping( - self, + mut self, base: *mut libc::c_void, len: usize, ) -> Result { - let func = Box::new(move |call_ctx: &mut MultiUseGuestCallContext| { - let guest_base: usize = MAPPED_BINARY_VA as usize; - let rgn = MemoryRegion { - host_region: base as usize..base.wrapping_add(len) as usize, - guest_region: guest_base..guest_base + len, - flags: MemoryRegionFlags::READ | MemoryRegionFlags::EXECUTE, - region_type: MemoryRegionType::Heap, - }; - if let Ok(()) = unsafe { call_ctx.map_region(&rgn) } { - call_ctx.call("LoadWasmModulePhys", (MAPPED_BINARY_VA, len as u64)) - } else { - let wasm_bytes = - unsafe { std::slice::from_raw_parts(base as *const u8, len).to_vec() }; - Self::load_module_from_buffer_transition_func(wasm_bytes)(call_ctx) - } - }); - self.load_module_inner(func) - } - - // todo: take a slice rather than a vec (requires somewhat - // refactoring the flatbuffers stuff maybe) - fn load_module_from_buffer_transition_func( - buffer: Vec, - ) -> impl FnOnce(&mut MultiUseGuestCallContext) -> Result<()> { - move |call_ctx: &mut MultiUseGuestCallContext| { - let len = buffer.len() as i32; - let res: i32 = call_ctx.call("LoadWasmModule", (buffer, len))?; - if res != 0 { - return Err(new_error!( - "LoadWasmModule Failed with error code {:?}", - res - )); - } - Ok(()) + let inner = self + .inner + .as_mut() + .ok_or_else(|| new_error!("WasmSandbox is None"))?; + + let guest_base: usize = MAPPED_BINARY_VA as usize; + let rgn = MemoryRegion { + host_region: base as usize..base.wrapping_add(len) as usize, + guest_region: guest_base..guest_base + len, + flags: MemoryRegionFlags::READ | MemoryRegionFlags::EXECUTE, + region_type: MemoryRegionType::Heap, + }; + if let Ok(()) = unsafe { inner.map_region(&rgn) } { + inner.call::<()>("LoadWasmModulePhys", (MAPPED_BINARY_VA, len as u64))?; + } else { + let wasm_bytes = unsafe { std::slice::from_raw_parts(base as *const u8, len).to_vec() }; + load_wasm_module_from_bytes(inner, wasm_bytes)?; } + + self.finalize_module_load() } /// Load a Wasm module from a buffer of bytes into the sandbox and return a `LoadedWasmSandbox` @@ -130,29 +136,44 @@ impl WasmSandbox { /// /// Before you can call guest functions in the sandbox, you must call /// this function and use the returned value to call guest functions. - pub fn load_module_from_buffer(self, buffer: &[u8]) -> Result { + pub fn load_module_from_buffer(mut self, buffer: &[u8]) -> Result { + let inner = self + .inner + .as_mut() + .ok_or_else(|| new_error!("WasmSandbox is None"))?; + // TODO: get rid of this clone - let func = Self::load_module_from_buffer_transition_func(buffer.to_vec()); + load_wasm_module_from_bytes(inner, buffer.to_vec())?; - self.load_module_inner(func) + self.finalize_module_load() } - fn load_module_inner Result<()>>( - mut self, - func: F, - ) -> Result { - let transition_func = MultiUseContextCallback::from(func); - match self.inner.take() { - Some(sbox) => { - let new_sbox: MultiUseSandbox = sbox.evolve(transition_func)?; - metrics::counter!(METRIC_SANDBOX_LOADS).increment(1); - LoadedWasmSandbox::new(new_sbox) - } - None => Err(new_error!("WasmSandbox is None, cannot load module")), + /// Helper function to finalize module loading and create LoadedWasmSandbox + fn finalize_module_load(mut self) -> Result { + metrics::counter!(METRIC_SANDBOX_LOADS).increment(1); + match (self.inner.take(), self.snapshot.take()) { + (Some(sandbox), Some(snapshot)) => LoadedWasmSandbox::new(sandbox, snapshot), + _ => Err(new_error!( + "WasmSandbox/snapshot is None, cannot load module" + )), } } } +fn load_wasm_module_from_bytes(inner: &mut MultiUseSandbox, wasm_bytes: Vec) -> Result<()> { + let res: i32 = inner.call( + "LoadWasmModule", + (wasm_bytes.clone(), wasm_bytes.len() as i32), + )?; + if res != 0 { + return Err(new_error!( + "LoadWasmModule Failed with error code {:?}", + res + )); + } + Ok(()) +} + impl std::fmt::Debug for WasmSandbox { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("WasmSandbox").finish() From 8176d9abe10b2d8af46368d22296a079e03156c3 Mon Sep 17 00:00:00 2001 From: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com> Date: Thu, 24 Jul 2025 19:53:15 -0700 Subject: [PATCH 4/6] [guest] improve WASM runtime memory management - Reuse wasmtime Store and Instance across guest function calls instead of creating new one per call. - Establish memory contract between host and guest. - Guest functions takes ownership of input parameters - Guest transfer ownership of return values - Host functions parameters are borrowed from guest - Host function return values are owned by guest and guest must free them. - Component: Add post_return calls for proper WASM function cleanup - Fix ABI mismatch in parameter of guest_dispatch_function Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com> --- src/hyperlight_wasm_macro/src/wasmguest.rs | 10 +- src/wasm_runtime/src/hostfuncs.rs | 4 +- src/wasm_runtime/src/marshal.rs | 107 +++++++++++++++++++-- src/wasm_runtime/src/module.rs | 66 +++++++++---- src/wasm_runtime/src/platform.rs | 4 +- 5 files changed, 156 insertions(+), 35 deletions(-) diff --git a/src/hyperlight_wasm_macro/src/wasmguest.rs b/src/hyperlight_wasm_macro/src/wasmguest.rs index 02c2dce..01fd499 100644 --- a/src/hyperlight_wasm_macro/src/wasmguest.rs +++ b/src/hyperlight_wasm_macro/src/wasmguest.rs @@ -212,15 +212,17 @@ fn emit_wasm_function_call( let rwt = match result { None => { quote! { - instance.get_typed_func::<(#(#pwts,)*), ()>(&mut *store, func_idx)? - .call(&mut *store, (#(#pus,)*))?; + let func = instance.get_typed_func::<(#(#pwts,)*), ()>(&mut *store, func_idx)?; + func.call(&mut *store, (#(#pus,)*))?; + func.post_return(&mut *store)?; } } _ => { let r = rtypes::emit_func_result(s, result); quote! { - let #ret = instance.get_typed_func::<(#(#pwts,)*), ((#r,))>(&mut *store, func_idx)? - .call(&mut *store, (#(#pus,)*))?.0; + let func = instance.get_typed_func::<(#(#pwts,)*), ((#r,))>(&mut *store, func_idx)?; + let #ret = func.call(&mut *store, (#(#pus,)*))?.0; + func.post_return(&mut *store)?; } } }; diff --git a/src/wasm_runtime/src/hostfuncs.rs b/src/wasm_runtime/src/hostfuncs.rs index 943d411..e468c55 100644 --- a/src/wasm_runtime/src/hostfuncs.rs +++ b/src/wasm_runtime/src/hostfuncs.rs @@ -79,9 +79,9 @@ pub(crate) fn hostfunc_type(d: &HostFunctionDefinition, e: &Engine) -> Result( d: &HostFunctionDefinition, - mut c: Caller<'_, ()>, + mut c: Caller<'_, T>, ps: &[Val], rs: &mut [Val], ) -> Result<()> { diff --git a/src/wasm_runtime/src/marshal.rs b/src/wasm_runtime/src/marshal.rs index 3ce22c0..58a0f5b 100644 --- a/src/wasm_runtime/src/marshal.rs +++ b/src/wasm_runtime/src/marshal.rs @@ -14,6 +14,34 @@ See the License for the specific language governing permissions and limitations under the License. */ +//! Parameter and return value marshalling for WASM guest function calls. +//! +//! # Memory Management Contract +//! +//! This module implements a clear memory ownership model for both guest function calls and host function calls: +//! +//! ## Guest Function Parameters (Host → Guest) +//! - When calling guest functions with String or VecBytes parameters, the host allocates memory +//! in the guest's memory space and passes pointers to the guest. +//! - **The guest owns these allocations and must free them** when no longer needed using the +//! `free` function exported from the guest module. +//! +//! ## Guest Function Return Values (Guest → Host) +//! - When guest functions return String or VecBytes values, the guest allocates memory in its +//! own memory space and returns pointers to the host. +//! - **The host takes ownership of these allocations and will free them** on the next VM entry +//! to prevent memory leaks. +//! +//! ## Host Function Parameters (Guest → Host) +//! - When guest code calls host functions with String or VecBytes parameters, the guest passes +//! pointers to data in its own memory space. +//! - **The guest retains ownership** of these allocations and remains responsible for freeing them. +//! +//! ## Host Function Return Values (Host → Guest) +//! - When host functions return String or VecBytes values to the guest, the host allocates memory +//! in the guest's memory space and returns pointers. +//! - **The guest owns these allocations and must free them** when no longer needed. + extern crate alloc; use alloc::ffi::CString; @@ -29,6 +57,28 @@ use hyperlight_common::flatbuffer_wrappers::util::get_flatbuffer_result; use hyperlight_guest::error::{HyperlightGuestError, Result}; use wasmtime::{AsContextMut, Extern, Val}; +use spin::Mutex; + +// Global tracking for return value allocations that need to be freed on next VM entry +static RETURN_VALUE_ALLOCATIONS: Mutex> = Mutex::new(Vec::new()); + +/// Track a return value allocation that should be freed on the next VM entry +fn track_return_value_allocation(addr: i32) { + RETURN_VALUE_ALLOCATIONS.lock().push(addr); +} + +/// Free all tracked return value allocations from previous VM calls +pub fn free_return_value_allocations( + ctx: &mut C, + get_export: &impl Fn(&mut C, &str) -> Option, +) -> Result<()> { + let mut allocations = RETURN_VALUE_ALLOCATIONS.lock(); + for addr in allocations.drain(..) { + free(ctx, get_export, addr)?; + } + Ok(()) +} + fn malloc( ctx: &mut C, get_export: &impl Fn(&mut C, &str) -> Option, @@ -46,6 +96,21 @@ fn malloc( Ok(addr) } +fn free( + ctx: &mut C, + get_export: &impl Fn(&mut C, &str) -> Option, + addr: i32, +) -> Result<()> { + let free = get_export(&mut *ctx, "free") + .and_then(Extern::into_func) + .ok_or(HyperlightGuestError::new( + ErrorCode::GuestError, + "free function not exported".to_string(), + ))?; + free.typed::(&mut *ctx)?.call(&mut *ctx, addr)?; + Ok(()) +} + fn write( ctx: &mut C, get_export: &impl Fn(&mut C, &str) -> Option, @@ -126,6 +191,11 @@ fn read_cstr( }) } +/// Convert a hyperlight parameter value to a wasmtime value. +/// +/// For String and VecBytes parameter types, this allocates memory in the guest's memory space +/// and returns a pointer. The guest function is responsible for freeing this memory when it is no +/// longer needed using the `free` function exported from the guest module. pub fn hl_param_to_val( mut ctx: C, get_export: impl Fn(&mut C, &str) -> Option, @@ -155,6 +225,11 @@ pub fn hl_param_to_val( } } +/// Convert guest function return values to hyperlight return value. +/// +/// For String and VecBytes return types, the guest has allocated memory in its own memory space +/// and returned pointers. The host takes ownership of these allocations and tracks them for +/// automatic cleanup on the next VM entry to prevent memory leaks. pub fn val_to_hl_result( mut ctx: C, get_export: impl Fn(&mut C, &str) -> Option, @@ -172,15 +247,21 @@ pub fn val_to_hl_result( /* todo: get_flatbuffer_result_from_bool is missing */ (ReturnType::Float, Val::F32(f)) => Ok(get_flatbuffer_result::(f32::from_bits(f))), (ReturnType::Double, Val::F64(f)) => Ok(get_flatbuffer_result::(f64::from_bits(f))), - (ReturnType::String, Val::I32(p)) => Ok(get_flatbuffer_result::<&str>( - read_cstr(&mut ctx, &get_export, p)?.to_str().map_err(|e| { - HyperlightGuestError::new( - ErrorCode::GuestError, - format!("non-UTF-8 c string in guest function return: {}", e), - ) - })?, - )), + (ReturnType::String, Val::I32(p)) => { + // Track this allocation so it can be freed on next VM entry + track_return_value_allocation(p); + Ok(get_flatbuffer_result::<&str>( + read_cstr(&mut ctx, &get_export, p)?.to_str().map_err(|e| { + HyperlightGuestError::new( + ErrorCode::GuestError, + format!("non-UTF-8 c string in guest function return: {}", e), + ) + })?, + )) + } (ReturnType::VecBytes, Val::I32(ret)) => { + // Track this allocation so it can be freed on next VM entry + track_return_value_allocation(ret); let mut size_bytes = [0; 4]; read(&mut ctx, &get_export, ret, &mut size_bytes)?; let size = i32::from_le_bytes(size_bytes); @@ -198,6 +279,11 @@ pub fn val_to_hl_result( } } +/// Convert guest-provided WASM values to hyperlight parameters for host function calls. +/// +/// For String and VecBytes parameter types, the guest passes pointers to data in its own +/// memory space. The guest retains ownership of these allocations and remains responsible +/// for freeing them. This function only reads the data without taking ownership. pub fn val_to_hl_param<'a, C: AsContextMut>( ctx: &mut C, get_export: impl Fn(&mut C, &str) -> Option, @@ -248,6 +334,11 @@ pub fn val_to_hl_param<'a, C: AsContextMut>( } } +/// Convert a hyperlight return value to a wasmtime value for host function returns. +/// +/// For String and VecBytes return types, this allocates memory in the guest's memory space +/// and returns a pointer. The guest owns these allocations and must free them when no longer needed +/// using the `free` function exported from the guest module. pub fn hl_return_to_val( ctx: &mut C, get_export: impl Fn(&mut C, &str) -> Option, diff --git a/src/wasm_runtime/src/module.rs b/src/wasm_runtime/src/module.rs index c9aec48..e3fa630 100644 --- a/src/wasm_runtime/src/module.rs +++ b/src/wasm_runtime/src/module.rs @@ -17,7 +17,7 @@ limitations under the License. use alloc::string::ToString; use alloc::vec::Vec; use alloc::{format, vec}; -use core::ops::Deref; +use core::ops::{Deref, DerefMut}; use hyperlight_common::flatbuffer_wrappers::function_call::FunctionCall; use hyperlight_common::flatbuffer_wrappers::function_types::{ @@ -34,35 +34,41 @@ use wasmtime::{Config, Engine, Linker, Module, Store, Val}; use crate::{hostfuncs, marshal, platform, wasip1}; +// Set by transition to WasmSandbox (by init_wasm_runtime) static CUR_ENGINE: Mutex> = Mutex::new(None); static CUR_LINKER: Mutex>> = Mutex::new(None); +// Set by transition to LoadedWasmSandbox (by load_wasm_module/load_wasm_module_phys) static CUR_MODULE: Mutex> = Mutex::new(None); +static CUR_STORE: Mutex>> = Mutex::new(None); +static CUR_INSTANCE: Mutex> = Mutex::new(None); #[no_mangle] -pub fn guest_dispatch_function(function_call: &FunctionCall) -> Result> { - let engine = CUR_ENGINE.lock(); - let engine = engine.deref().as_ref().ok_or(HyperlightGuestError::new( +pub fn guest_dispatch_function(function_call: FunctionCall) -> Result> { + let mut store = CUR_STORE.lock(); + let store = store.deref_mut().as_mut().ok_or(HyperlightGuestError::new( ErrorCode::GuestError, - "Wasm runtime is not initialized".to_string(), + "No wasm store available".to_string(), ))?; - let linker = CUR_LINKER.lock(); - let linker = linker.deref().as_ref().ok_or(HyperlightGuestError::new( + let instance = CUR_INSTANCE.lock(); + let instance = instance.deref().as_ref().ok_or(HyperlightGuestError::new( ErrorCode::GuestError, - "impossible: wasm runtime has no valid linker".to_string(), + "No wasm instance available".to_string(), ))?; - let module = CUR_MODULE.lock(); - let module = module.deref().as_ref().ok_or(HyperlightGuestError::new( - ErrorCode::GuestError, - "No wasm module loaded".to_string(), - ))?; - let mut store = Store::new(engine, ()); - let instance = linker.instantiate(&mut store, module)?; + + // Free any return value allocations from the previous VM call + // This implements the memory model where hyperlight owns return values + // and frees them on the next VM entry + marshal::free_return_value_allocations(&mut *store, &|ctx, name| { + instance.get_export(ctx, name) + })?; + let func = instance - .get_func(&mut store, &function_call.function_name) + .get_func(&mut *store, &function_call.function_name) .ok_or(HyperlightGuestError::new( ErrorCode::GuestError, "Function not found".to_string(), ))?; + let mut w_params = vec![]; for f_param in (function_call.parameters) .as_ref() @@ -70,7 +76,7 @@ pub fn guest_dispatch_function(function_call: &FunctionCall) -> Result> .iter() { w_params.push(marshal::hl_param_to_val( - &mut store, + &mut *store, |ctx, name| instance.get_export(ctx, name), f_param, )?); @@ -78,9 +84,9 @@ pub fn guest_dispatch_function(function_call: &FunctionCall) -> Result> let is_void = ReturnType::Void == function_call.expected_return_type; let n_results = if is_void { 0 } else { 1 }; let mut results = vec![Val::I32(0); n_results]; - func.call(&mut store, &w_params, &mut results)?; + func.call(&mut *store, &w_params, &mut results)?; marshal::val_to_hl_result( - &mut store, + &mut *store, |ctx, name| instance.get_export(ctx, name), function_call.expected_return_type, &results, @@ -124,8 +130,19 @@ fn load_wasm_module(function_call: &FunctionCall) -> Result> { &function_call.parameters.as_ref().unwrap()[1], &*CUR_ENGINE.lock(), ) { + let linker = CUR_LINKER.lock(); + let linker = linker.deref().as_ref().ok_or(HyperlightGuestError::new( + ErrorCode::GuestError, + "impossible: wasm runtime has no valid linker".to_string(), + ))?; + let module = unsafe { Module::deserialize(engine, wasm_bytes)? }; + let mut store = Store::new(engine, ()); + let instance = linker.instantiate(&mut store, &module)?; + *CUR_MODULE.lock() = Some(module); + *CUR_STORE.lock() = Some(store); + *CUR_INSTANCE.lock() = Some(instance); Ok(get_flatbuffer_result::(0)) } else { Err(HyperlightGuestError::new( @@ -141,8 +158,19 @@ fn load_wasm_module_phys(function_call: &FunctionCall) -> Result> { &function_call.parameters.as_ref().unwrap()[1], &*CUR_ENGINE.lock(), ) { + let linker = CUR_LINKER.lock(); + let linker = linker.deref().as_ref().ok_or(HyperlightGuestError::new( + ErrorCode::GuestError, + "impossible: wasm runtime has no valid linker".to_string(), + ))?; + let module = unsafe { Module::deserialize_raw(engine, platform::map_buffer(*phys, *len))? }; + let mut store = Store::new(engine, ()); + let instance = linker.instantiate(&mut store, &module)?; + *CUR_MODULE.lock() = Some(module); + *CUR_STORE.lock() = Some(store); + *CUR_INSTANCE.lock() = Some(instance); Ok(get_flatbuffer_result::<()>(())) } else { Err(HyperlightGuestError::new( diff --git a/src/wasm_runtime/src/platform.rs b/src/wasm_runtime/src/platform.rs index df15ede..bcd84cb 100644 --- a/src/wasm_runtime/src/platform.rs +++ b/src/wasm_runtime/src/platform.rs @@ -59,7 +59,7 @@ pub(crate) fn register_page_fault_handler() { // See AMD64 Architecture Programmer's Manual, Volume 2 // §8.2 Vectors, p. 245 // Table 8-1: Interrupt Vector Source and Cause - handler::handlers[14].store(page_fault_handler as usize as u64, Ordering::Release); + handler::HANDLERS[14].store(page_fault_handler as usize as u64, Ordering::Release); } // Wasmtime Embedding Interface @@ -155,7 +155,7 @@ pub extern "C" fn wasmtime_init_traps(handler: wasmtime_trap_handler_t) -> i32 { // See AMD64 Architecture Programmer's Manual, Volume 2 // §8.2 Vectors, p. 245 // Table 8-1: Interrupt Vector Source and Cause - handler::handlers[6].store(wasmtime_trap_handler as usize as u64, Ordering::Release); + handler::HANDLERS[6].store(wasmtime_trap_handler as usize as u64, Ordering::Release); // TODO: Add handlers for any other traps that wasmtime needs, // probably including at least some floating-point // exceptions From 1da37178a8d98b90ed84b4c964406d57a938a625 Mon Sep 17 00:00:00 2001 From: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com> Date: Fri, 1 Aug 2025 12:34:42 -0700 Subject: [PATCH 5/6] Update wasm files to account for new memory contracts Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com> --- src/wasmsamples/HelloWorld.c | 1 + src/wasmsamples/RunWasm.c | 16 ++++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/wasmsamples/HelloWorld.c b/src/wasmsamples/HelloWorld.c index f71128a..22eb3d5 100644 --- a/src/wasmsamples/HelloWorld.c +++ b/src/wasmsamples/HelloWorld.c @@ -42,6 +42,7 @@ int HelloWorld(char* msg) printf("contents of buffer after snprintf: %s\n", buf); free(buf); + free(msg); // Free the msg since we own it return 0; } diff --git a/src/wasmsamples/RunWasm.c b/src/wasmsamples/RunWasm.c index 2515b4d..3d40682 100644 --- a/src/wasmsamples/RunWasm.c +++ b/src/wasmsamples/RunWasm.c @@ -36,7 +36,7 @@ int CalcFib(int n) } } -// This function receives an array of bytes followed by a length and then returns a pointer to a buffer where the first 4 bytes is the length followed by the data. +// This function receives an array of bytes followed by a length and then returns a buffer where the first 4 bytes is the length followed by the data. __attribute__((export_name("ReceiveByteArray"))) void* ReceiveByteArray(void* data, int length) { @@ -45,15 +45,17 @@ void* ReceiveByteArray(void* data, int length) { result += 4; memcpy(result, data, length); result -= 4; - return result; + free(data); // Free the guest parameter, which we own + return result; // Transfer ownership of return value to host } __attribute__((export_name("WasmPrintUsingHostPrint"))) int WasmPrintUsingHostPrint(char* msg) { - // Host Print now returns a flatbuffer buffer - HostPrint(msg); - return strlen(msg); + HostPrint(msg); // Host borrows msg + int len = strlen(msg); + free(msg); // Free the param since we own + return len; } __attribute__((export_name("PrintHelloWorld"))) @@ -67,12 +69,13 @@ __attribute__((export_name("Print"))) void Print(char* msg) { HostPrint(msg); + free(msg); // Free the msg since we own it } __attribute__((export_name("Echo"))) char* Echo(char* msg) { - return msg; + return msg; // Transfer ownership to host } __attribute__((export_name("ToUpper"), optnone)) @@ -96,6 +99,7 @@ __attribute__((export_name("PrintUpper"), optnone)) void PrintUpper(char* msg) { HostPrint(ToUpper(msg)); + free(msg); } __attribute__((export_name("KeepCPUBusy"))) From 031e48f94feb96073307daaeaca5d9f5d6136c7a Mon Sep 17 00:00:00 2001 From: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com> Date: Thu, 7 Aug 2025 16:58:27 -0700 Subject: [PATCH 6/6] [test dirty pages] Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com> --- .devcontainer/Dockerfile | 2 +- .github/workflows/Benchmarks.yml | 4 +- .github/workflows/CargoAudit.yml | 2 +- .github/workflows/CreateDevcontainerImage.yml | 2 +- .github/workflows/CreateRelease.yml | 2 +- .github/workflows/dep_build_wasm_examples.yml | 2 +- .github/workflows/dep_cargo_publish.yml | 2 +- .github/workflows/dep_rust.yml | 2 +- Cargo.lock | 278 +++++++++-------- Cargo.toml | 2 +- README.md | 6 +- rust-toolchain.toml | 2 +- src/hyperlight_wasm/Cargo.toml | 2 +- src/hyperlight_wasm_macro/Cargo.toml | 2 +- src/wasm_runtime/Cargo.lock | 287 ++++++++++++------ src/wasm_runtime/Cargo.toml | 6 +- 16 files changed, 364 insertions(+), 239 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 9eb6f80..91773fe 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -28,7 +28,7 @@ RUN wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WA && mv /wasi-sdk-${WASI_SDK_VERSION_FULL}-x86_64-linux /opt/wasi-sdk USER $USER -ARG RUST_TOOLCHAIN=1.85.0 +ARG RUST_TOOLCHAIN=1.86.0 # Install rust and component tools RUN rustup default ${RUST_TOOLCHAIN} \ diff --git a/.github/workflows/Benchmarks.yml b/.github/workflows/Benchmarks.yml index 9b0d538..333d174 100644 --- a/.github/workflows/Benchmarks.yml +++ b/.github/workflows/Benchmarks.yml @@ -36,13 +36,13 @@ jobs: - uses: hyperlight-dev/ci-setup-workflow@v1.5.0 with: - rust-toolchain: "1.85.0" + rust-toolchain: "1.86.0" - name: Build Wasm Runtime Binary working-directory: ./src/hyperlight_wasm run: just build-wasm-runtime ${{ matrix.config }} - - uses: dtolnay/rust-toolchain@1.85.0 + - uses: dtolnay/rust-toolchain@1.86.0 with: components: clippy, rustfmt diff --git a/.github/workflows/CargoAudit.yml b/.github/workflows/CargoAudit.yml index 662fba6..d1444c7 100644 --- a/.github/workflows/CargoAudit.yml +++ b/.github/workflows/CargoAudit.yml @@ -18,7 +18,7 @@ jobs: # We are not using the common workflow here because it installs a lot of tools we don't need - uses: dtolnay/rust-toolchain@master with: - toolchain: "1.85.0" + toolchain: "1.86.0" - uses: extractions/setup-just@v3 with: diff --git a/.github/workflows/CreateDevcontainerImage.yml b/.github/workflows/CreateDevcontainerImage.yml index a7fe4dc..da7a7b2 100644 --- a/.github/workflows/CreateDevcontainerImage.yml +++ b/.github/workflows/CreateDevcontainerImage.yml @@ -16,7 +16,7 @@ env: USER: vscode GROUP: vscode LLVM_VERSION: 17 - RUST_TOOLCHAIN_DEFAULT: 1.85.0 + RUST_TOOLCHAIN_DEFAULT: 1.86.0 RUST_TOOLCHAIN_FILE: rust-toolchain.toml WASI_SDK_VERSION_FULL: "25.0" GCC_VERSION: "12" diff --git a/.github/workflows/CreateRelease.yml b/.github/workflows/CreateRelease.yml index 9b1afca..533679e 100644 --- a/.github/workflows/CreateRelease.yml +++ b/.github/workflows/CreateRelease.yml @@ -37,7 +37,7 @@ jobs: - name: Hyperlight setup uses: hyperlight-dev/ci-setup-workflow@v1.5.0 with: - rust-toolchain: "1.85.0" + rust-toolchain: "1.86.0" - name: Verify vendor.tar if: ${{ contains(github.ref, 'refs/heads/release/') }} run: | diff --git a/.github/workflows/dep_build_wasm_examples.yml b/.github/workflows/dep_build_wasm_examples.yml index c90c872..9888d56 100644 --- a/.github/workflows/dep_build_wasm_examples.yml +++ b/.github/workflows/dep_build_wasm_examples.yml @@ -33,7 +33,7 @@ jobs: - name: Hyperlight setup workflow uses: hyperlight-dev/ci-setup-workflow@v1.5.0 with: - rust-toolchain: "1.85.0" + rust-toolchain: "1.86.0" - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Login to Registry diff --git a/.github/workflows/dep_cargo_publish.yml b/.github/workflows/dep_cargo_publish.yml index a172361..828d30d 100644 --- a/.github/workflows/dep_cargo_publish.yml +++ b/.github/workflows/dep_cargo_publish.yml @@ -22,7 +22,7 @@ jobs: - name: Hyperlight setup uses: hyperlight-dev/ci-setup-workflow@v1.5.0 with: - rust-toolchain: "1.85.0" + rust-toolchain: "1.86.0" # github actions that run against PRs check out a ref to the PR merge branch # we need to switch / create a branch for cargo ws to run late diff --git a/.github/workflows/dep_rust.yml b/.github/workflows/dep_rust.yml index 163a558..bcba1c3 100644 --- a/.github/workflows/dep_rust.yml +++ b/.github/workflows/dep_rust.yml @@ -52,7 +52,7 @@ jobs: - name: Hyperlight setup uses: hyperlight-dev/ci-setup-workflow@v1.5.0 with: - rust-toolchain: "1.85.0" + rust-toolchain: "1.86.0" - name: Add Nightly Rust run: | diff --git a/Cargo.lock b/Cargo.lock index b948f4d..900fdea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -26,7 +26,7 @@ dependencies = [ "cfg-if", "once_cell", "version_check", - "zerocopy 0.8.25", + "zerocopy 0.8.26", ] [[package]] @@ -67,9 +67,9 @@ checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" [[package]] name = "anstream" -version = "0.6.19" +version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301af1932e46185686725e0fad2f8f2aa7da69dd70bf6ecc44d6b703844a3933" +checksum = "3ae563653d1938f79b1ab1b5e668c87c76a9930414574a6583a7b7e11a8e6192" dependencies = [ "anstyle", "anstyle-parse", @@ -97,22 +97,22 @@ dependencies = [ [[package]] name = "anstyle-query" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8bdeb6047d8983be085bab0ba1472e6dc604e7041dbf6fcd5e71523014fae9" +checksum = "9e231f6134f61b71076a3eab506c379d4f36122f2af15a9ff04415ea4c3339e2" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] name = "anstyle-wincon" -version = "3.0.9" +version = "3.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "403f75924867bb1033c59fbf0797484329750cfbe3c4325cd33127941fabc882" +checksum = "3e0633414522a32ffaac8ac6cc8f748e090c5717661fddeea04219e2344f5f2a" dependencies = [ "anstyle", "once_cell_polyfill", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -158,15 +158,15 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] name = "autocfg" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] name = "aws-lc-rs" -version = "1.13.1" +version = "1.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fcc8f365936c834db5514fc45aee5b1202d677e6b40e48468aaaa8183ca8c7" +checksum = "5c953fe1ba023e6b7730c0d4b031d06f267f23a46167dcbd40316644b10a17ba" dependencies = [ "aws-lc-sys", "zeroize", @@ -174,9 +174,9 @@ dependencies = [ [[package]] name = "aws-lc-sys" -version = "0.29.0" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61b1d86e7705efe1be1b569bab41d4fa1e14e220b60a160f78de2db687add079" +checksum = "dbfd150b5dbdb988bcc8fb1fe787eb6b7ee6180ca24da683b61ea5405f3d43ff" dependencies = [ "bindgen", "cc", @@ -285,9 +285,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.18.1" +version = "3.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db76d6187cd04dff33004d8e6c9cc4e05cd330500379d2394209271b4aeee" +checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" dependencies = [ "allocator-api2", ] @@ -306,9 +306,9 @@ checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" [[package]] name = "camino" -version = "1.1.10" +version = "1.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0da45bc31171d8d6960122e222a67740df867c1dd53b4d51caa297084c185cab" +checksum = "5d07aa9a93b00c76f71bc35d598bed923f6d4f3a9ca5c24b7737ae1a292841c0" dependencies = [ "serde", ] @@ -361,9 +361,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.2.26" +version = "1.2.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "956a5e21988b87f372569b66183b78babf23ebc2e744b733e4350a752c4dafac" +checksum = "c3a42d84bb6b69d3a8b3eaacf0d88f179e1929695e1ad012b6cf64d9caaa5fd2" dependencies = [ "jobserver", "libc", @@ -445,18 +445,18 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.41" +version = "4.5.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be92d32e80243a54711e5d7ce823c35c41c9d929dc4ab58e1276f625841aadf9" +checksum = "50fd97c9dc2399518aa331917ac6f274280ec5eb34e555dd291899745c48ec6f" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.5.41" +version = "4.5.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707eab41e9622f9139419d573eca0900137718000c517d47da73045f54331c3d" +checksum = "c35b5830294e1fa0462034af85cc95225a4cb07092c088c55bda3147cfcd8f65" dependencies = [ "anstream", "anstyle", @@ -664,9 +664,9 @@ checksum = "8c3d9071bc5ee5573e723d9d84a45b7025a29e8f2c5ad81b3b9d0293129541d9" [[package]] name = "crc32fast" -version = "1.4.2" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" dependencies = [ "cfg-if", ] @@ -749,9 +749,9 @@ checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" [[package]] name = "crunchy" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43da5946c66ffcc7745f48db692ffbb10a83bfe0afd96235c5c2a4fb23994929" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" [[package]] name = "crypto-common" @@ -899,12 +899,12 @@ dependencies = [ [[package]] name = "errno" -version = "0.3.12" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cea14ef9355e3beab063703aa9dab15afd25f0667c341310c1e5274bb1d0da18" +checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -1097,9 +1097,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.10" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9421a676d1b147b16b82c9225157dc629087ef8ec4d5e2960f9437a90dac0a5" +checksum = "f3c0b69cfcb4e1b9f1bf2f53f95f766e4661169728ec61cd3fe5a0166f2d1386" dependencies = [ "atomic-waker", "bytes", @@ -1241,9 +1241,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.14" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc2fdfdbff08affe55bb779f33b053aa1fe5dd5b54c257343c17edfa55711bdb" +checksum = "8d9b05277c7e8da2c93a568989bb6207bef0112e8d17df7a6eda4a3cf143bc5e" dependencies = [ "bytes", "futures-channel", @@ -1263,7 +1263,7 @@ dependencies = [ [[package]] name = "hyperlight-common" version = "0.7.0" -source = "git+https://github.com/hyperlight-dev/hyperlight?rev=172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1#172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1" +source = "git+https://github.com/hyperlight-dev/hyperlight?rev=abdb96dcdbe96faf2e6b01ab3e3e8a7f699af8b8#abdb96dcdbe96faf2e6b01ab3e3e8a7f699af8b8" dependencies = [ "anyhow", "flatbuffers", @@ -1275,7 +1275,7 @@ dependencies = [ [[package]] name = "hyperlight-component-macro" version = "0.7.0" -source = "git+https://github.com/hyperlight-dev/hyperlight?rev=172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1#172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1" +source = "git+https://github.com/hyperlight-dev/hyperlight?rev=abdb96dcdbe96faf2e6b01ab3e3e8a7f699af8b8#abdb96dcdbe96faf2e6b01ab3e3e8a7f699af8b8" dependencies = [ "env_logger", "hyperlight-component-util", @@ -1284,13 +1284,13 @@ dependencies = [ "proc-macro2", "quote", "syn", - "wasmparser 0.235.0", + "wasmparser 0.236.0", ] [[package]] name = "hyperlight-component-util" version = "0.7.0" -source = "git+https://github.com/hyperlight-dev/hyperlight?rev=172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1#172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1" +source = "git+https://github.com/hyperlight-dev/hyperlight?rev=abdb96dcdbe96faf2e6b01ab3e3e8a7f699af8b8#abdb96dcdbe96faf2e6b01ab3e3e8a7f699af8b8" dependencies = [ "itertools 0.14.0", "log", @@ -1298,13 +1298,13 @@ dependencies = [ "proc-macro2", "quote", "syn", - "wasmparser 0.235.0", + "wasmparser 0.236.0", ] [[package]] name = "hyperlight-host" version = "0.7.0" -source = "git+https://github.com/hyperlight-dev/hyperlight?rev=172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1#172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1" +source = "git+https://github.com/hyperlight-dev/hyperlight?rev=abdb96dcdbe96faf2e6b01ab3e3e8a7f699af8b8#abdb96dcdbe96faf2e6b01ab3e3e8a7f699af8b8" dependencies = [ "anyhow", "bitflags 2.9.1", @@ -1339,7 +1339,7 @@ dependencies = [ "tracing-core", "tracing-log", "uuid", - "vmm-sys-util", + "vmm-sys-util 0.15.0", "windows", "windows-result", "windows-sys 0.60.2", @@ -1369,7 +1369,7 @@ dependencies = [ "once_cell", "page_size", "tar", - "toml 0.9.2", + "toml 0.9.5", "tracing", "windows", ] @@ -1523,15 +1523,26 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.9.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" +checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661" dependencies = [ "equivalent", "hashbrown", "serde", ] +[[package]] +name = "io-uring" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d93587f37623a1a17d94ef2bc9ada592f5465fe7732084ab7beefabe5c77c0c4" +dependencies = [ + "bitflags 2.9.1", + "cfg-if", + "libc", +] + [[package]] name = "ipnet" version = "2.11.0" @@ -1636,7 +1647,7 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf3432d9f609fbede9f624d1dbefcce77985a9322de1d0e6d460ec05502b7fd0" dependencies = [ - "vmm-sys-util", + "vmm-sys-util 0.14.0", ] [[package]] @@ -1648,7 +1659,7 @@ dependencies = [ "bitflags 2.9.1", "kvm-bindings", "libc", - "vmm-sys-util", + "vmm-sys-util 0.14.0", ] [[package]] @@ -1677,9 +1688,9 @@ checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776" [[package]] name = "libgit2-sys" -version = "0.18.1+1.9.0" +version = "0.18.2+1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1dcb20f84ffcdd825c7a311ae347cce604a6f084a767dec4a4929829645290e" +checksum = "1c42fe03df2bd3c53a3a9c7317ad91d80c81cd1fb0caec8d7cc4cd2bfa10c222" dependencies = [ "cc", "libc", @@ -1694,7 +1705,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07033963ba89ebaf1584d767badaa2e8fcec21aedea6b8c0346d487d49c28667" dependencies = [ "cfg-if", - "windows-targets 0.53.2", + "windows-targets 0.53.3", ] [[package]] @@ -1705,9 +1716,9 @@ checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" [[package]] name = "libredox" -version = "0.1.3" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" +checksum = "391290121bad3d37fbddad76d8f5d1c1c314cfc646d143d7e07a3086ddff0ce3" dependencies = [ "bitflags 2.9.1", "libc", @@ -1869,7 +1880,7 @@ checksum = "f416b4432174e5a3f956a7887f4c1a4acea9511d81def67fcb8473293630ab9e" dependencies = [ "libc", "num_enum", - "vmm-sys-util", + "vmm-sys-util 0.15.0", "zerocopy 0.7.35", ] @@ -1881,8 +1892,8 @@ checksum = "1e0cb5031f3243a7459b7c13d960d25420980874eebda816db24ce6077e21d43" dependencies = [ "libc", "num_enum", - "vmm-sys-util", - "zerocopy 0.8.25", + "vmm-sys-util 0.15.0", + "zerocopy 0.8.26", ] [[package]] @@ -1894,7 +1905,7 @@ dependencies = [ "libc", "mshv-bindings 0.2.1", "thiserror 1.0.69", - "vmm-sys-util", + "vmm-sys-util 0.15.0", ] [[package]] @@ -1906,7 +1917,7 @@ dependencies = [ "libc", "mshv-bindings 0.3.2", "thiserror 2.0.12", - "vmm-sys-util", + "vmm-sys-util 0.15.0", ] [[package]] @@ -1950,18 +1961,19 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e613fc340b2220f734a8595782c551f1250e969d87d3be1ae0579e8d4065179" +checksum = "a973b4e44ce6cad84ce69d797acf9a044532e4184c4f267913d1b546a0727b7a" dependencies = [ "num_enum_derive", + "rustversion", ] [[package]] name = "num_enum_derive" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" +checksum = "77e878c846a8abae00dd069496dbe8751b16ac1c3d6bd2a7283a938e8228f90d" dependencies = [ "proc-macro2", "quote", @@ -2113,9 +2125,9 @@ dependencies = [ [[package]] name = "postcard" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c1de96e20f51df24ca73cafcc4690e044854d803259db27a00a461cb3b9d17a" +checksum = "6764c3b5dd454e283a30e6dfe78e9b31096d9e32036b5d1eaac7a6119ccb9a24" dependencies = [ "cobs", "embedded-io 0.4.0", @@ -2138,14 +2150,14 @@ version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" dependencies = [ - "zerocopy 0.8.25", + "zerocopy 0.8.26", ] [[package]] name = "prettyplease" -version = "0.2.35" +version = "0.2.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "061c1221631e079b26479d25bbf2275bfe5917ae8419cd7e34f13bfc2aa7539a" +checksum = "ff24dfcda44452b9816fff4cd4227e1bb73ff5a2f1bc1105aa92fb8565ce44d2" dependencies = [ "proc-macro2", "syn", @@ -2218,9 +2230,9 @@ dependencies = [ [[package]] name = "r-efi" -version = "5.2.0" +version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" [[package]] name = "radix_trie" @@ -2234,9 +2246,9 @@ dependencies = [ [[package]] name = "rand" -version = "0.9.1" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ "rand_chacha", "rand_core", @@ -2301,18 +2313,18 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.13" +version = "0.5.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d04b7d0ee6b4a0207a0a7adb104d23ecb0b47d6beae7152d0fa34b692b29fd6" +checksum = "5407465600fb0548f1442edf71dd20683c6ed326200ace4b1ef0763521bb3b77" dependencies = [ "bitflags 2.9.1", ] [[package]] name = "redox_users" -version = "0.5.0" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd6f9d3d47bdd2ad6945c5015a226ec6155d0bcdfd8f7cd29f86b71f8de99d2b" +checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac" dependencies = [ "getrandom 0.2.16", "libredox", @@ -2414,9 +2426,9 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.25" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "989e6739f80c4ad5b13e0fd7fe89531180375b18520cc8c82080e4dc4035b84f" +checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace" [[package]] name = "rustc-hash" @@ -2454,22 +2466,22 @@ dependencies = [ [[package]] name = "rustix" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266" +checksum = "11181fbabf243db407ef8df94a6ce0b2f9a733bd8be4ad02b4eda9602296cac8" dependencies = [ "bitflags 2.9.1", "errno", "libc", "linux-raw-sys 0.9.4", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] name = "rustls" -version = "0.23.27" +version = "0.23.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "730944ca083c1c233a75c09f199e973ca499344a2b7ba9e755c457e86fb4a321" +checksum = "c0ebcbd2f03de0fc1122ad9bb24b127a5a6cd51d72604a3f3c50ac459762b6cc" dependencies = [ "aws-lc-rs", "once_cell", @@ -2502,9 +2514,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.103.3" +version = "0.103.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4a72fe2bcf7a6ac6fd7d0b9e5cb68aeb7d4c0a0271730218b3e92d43b4eb435" +checksum = "0a17884ae0c1b773f1ccd2bd4a8c72f16da897310a98b0e84bf349ad5ead92fc" dependencies = [ "aws-lc-rs", "ring", @@ -2579,9 +2591,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "3.2.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "271720403f46ca04f7ba6f55d438f8bd878d6b8ca0a1046e8228c4145bcbb316" +checksum = "80fb1d92c5028aa318b4b8bd7302a5bfcf48be96a37fc6fc790f806b0004ee0c" dependencies = [ "bitflags 2.9.1", "core-foundation", @@ -2652,9 +2664,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.140" +version = "1.0.142" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" +checksum = "030fedb782600dcbd6f02d479bf0d817ac3bb40d644745b769d6a96bc3afc5a7" dependencies = [ "itoa", "memchr", @@ -2727,12 +2739,9 @@ checksum = "c1e9a774a6c28142ac54bb25d25562e6bcf957493a184f15ad4eebccb23e410a" [[package]] name = "slab" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] +checksum = "04dc19736151f35336d325007ac991178d504a119863a2fcb3758cdb5e52c50d" [[package]] name = "smallvec" @@ -2745,12 +2754,12 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.10" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" +checksum = "233504af464074f9d066d7b5416c5f9b894a5862a6506e306f7b816cdd6f1807" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -2890,17 +2899,19 @@ dependencies = [ [[package]] name = "tokio" -version = "1.45.1" +version = "1.47.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75ef51a33ef1da925cea3e4eb122833cb377c61439ca401b770f54902b806779" +checksum = "89e49afdadebb872d3145a5638b59eb0691ea23e46ca484037cfab3b76b95038" dependencies = [ "backtrace", "bytes", + "io-uring", "libc", "mio", "pin-project-lite", + "slab", "socket2", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -2915,9 +2926,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.15" +version = "0.7.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66a539a9ad6d5d281510d5bd368c973d636c02dbf8a67300bfb6b950696ad7df" +checksum = "14307c986784f72ef81c89db7d9e28d6ac26d16213b109ea501696195e6e3ce5" dependencies = [ "bytes", "futures-core", @@ -2940,9 +2951,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.9.2" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed0aee96c12fa71097902e0bb061a5e1ebd766a6636bb605ba401c45c1650eac" +checksum = "75129e1dc5000bfbaa9fee9d1b21f974f9fbad9daec557a521ee6e080825f6e8" dependencies = [ "indexmap", "serde", @@ -2987,9 +2998,9 @@ dependencies = [ [[package]] name = "toml_parser" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97200572db069e74c512a14117b296ba0a80a30123fbbb5aa1f4a348f639ca30" +checksum = "b551886f449aa90d4fe2bdaa9f4a2577ad2dde302c61ecf262d80b116db95c10" dependencies = [ "winnow", ] @@ -3002,9 +3013,9 @@ checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" [[package]] name = "toml_writer" -version = "1.0.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b679217f2848de74cabd3e8fc5e6d66f40b7da40f8e1954d92054d9010690fd5" +checksum = "fcc842091f2def52017664b53082ecbbeb5c7731092bad69d2c63050401dfd64" [[package]] name = "tower-service" @@ -3026,9 +3037,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.29" +version = "0.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1ffbcf9c6f6b99d386e7444eb608ba646ae452a36b39737deb9663b610f662" +checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" dependencies = [ "proc-macro2", "quote", @@ -3154,6 +3165,16 @@ dependencies = [ "libc", ] +[[package]] +name = "vmm-sys-util" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "506c62fdf617a5176827c2f9afbcf1be155b03a9b4bf9617a60dbc07e3a1642f" +dependencies = [ + "bitflags 1.3.2", + "libc", +] + [[package]] name = "walkdir" version = "2.5.0" @@ -3271,9 +3292,9 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.235.0" +version = "0.236.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "161296c618fa2d63f6ed5fffd1112937e803cb9ec71b32b01a76321555660917" +checksum = "16d1eee846a705f6f3cb9d7b9f79b54583810f1fb57a1e3aea76d1742db2e3d2" dependencies = [ "bitflags 2.9.1", "hashbrown", @@ -3317,7 +3338,7 @@ dependencies = [ "postcard", "psm", "pulley-interpreter", - "rustix 1.0.7", + "rustix 1.0.8", "semver", "serde", "serde_derive", @@ -3430,7 +3451,7 @@ dependencies = [ "cc", "cfg-if", "libc", - "rustix 1.0.7", + "rustix 1.0.8", "wasmtime-asm-macros", "wasmtime-versioned-export-macros", "windows-sys 0.59.0", @@ -3702,7 +3723,7 @@ version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" dependencies = [ - "windows-targets 0.53.2", + "windows-targets 0.53.3", ] [[package]] @@ -3723,10 +3744,11 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.53.2" +version = "0.53.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c66f69fcc9ce11da9966ddb31a40968cad001c5bedeb5c2b82ede4253ab48aef" +checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91" dependencies = [ + "windows-link", "windows_aarch64_gnullvm 0.53.0", "windows_aarch64_msvc 0.53.0", "windows_i686_gnu 0.53.0", @@ -3853,9 +3875,9 @@ checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" [[package]] name = "winnow" -version = "0.7.11" +version = "0.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74c7b26e3480b707944fc872477815d29a8e429d2f93a1ce000f5fa84a15cbcd" +checksum = "f3edebf492c8125044983378ecb5766203ad3b4c2f7a922bd7dd207f6d443e95" dependencies = [ "memchr", ] @@ -3895,12 +3917,12 @@ checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb" [[package]] name = "xattr" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d65cbf2f12c15564212d48f4e3dfb87923d25d611f2aed18f4cb23f0413d89e" +checksum = "af3a19837351dc82ba89f8a125e22a3c475f05aba604acc023d62b2739ae2909" dependencies = [ "libc", - "rustix 1.0.7", + "rustix 1.0.8", ] [[package]] @@ -3939,11 +3961,11 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.25" +version = "0.8.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1702d9583232ddb9174e01bb7c15a2ab8fb1bc6f227aa1233858c351a3ba0cb" +checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f" dependencies = [ - "zerocopy-derive 0.8.25", + "zerocopy-derive 0.8.26", ] [[package]] @@ -3959,9 +3981,9 @@ dependencies = [ [[package]] name = "zerocopy-derive" -version = "0.8.25" +version = "0.8.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28a6e20d751156648aa063f3800b706ee209a32c0b4d9f24be3d980b01be55ef" +checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181" dependencies = [ "proc-macro2", "quote", @@ -4008,9 +4030,9 @@ dependencies = [ [[package]] name = "zerovec" -version = "0.11.2" +version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a05eb080e015ba39cc9e23bbe5e7fb04d5fb040350f99f34e338d5fdd294428" +checksum = "e7aa2bd55086f1ab526693ecbe444205da57e25f4489879da80635a46d90e73b" dependencies = [ "yoke", "zerofrom", diff --git a/Cargo.toml b/Cargo.toml index 62cf1a2..7fee5b9 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", git = "https://github.com/hyperlight-dev/hyperlight", rev = "172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1", default-features = false, features = ["executable_heap", "init-paging"] } +hyperlight-host = { version = "0.7.0", git = "https://github.com/hyperlight-dev/hyperlight", rev = "abdb96dcdbe96faf2e6b01ab3e3e8a7f699af8b8", default-features = false, features = ["executable_heap", "init-paging"] } diff --git a/README.md b/README.md index 1d4fbe0..ffbe747 100644 --- a/README.md +++ b/README.md @@ -58,11 +58,11 @@ You should also add your user to the kvm group: `sudo adduser $USER kvm` ## Building -NOTE: Ensure that you use version 1.85.0 of rust toolchain. +NOTE: Ensure that you use version 1.86.0 of rust toolchain. ```Console -rustup install 1.85.0 -rustup default 1.85.0 +rustup install 1.86.0 +rustup default 1.86.0 ``` Now you can build the Rust Wasm library: diff --git a/rust-toolchain.toml b/rust-toolchain.toml index c1bc0a6..cf6d0f5 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.85.0" +channel = "1.86.0" diff --git a/src/hyperlight_wasm/Cargo.toml b/src/hyperlight_wasm/Cargo.toml index 46e96ac..f1790ac 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 = { version = "0.7.0", git = "https://github.com/hyperlight-dev/hyperlight", rev = "172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1" } +hyperlight-component-macro = { version = "0.7.0", git = "https://github.com/hyperlight-dev/hyperlight", rev = "abdb96dcdbe96faf2e6b01ab3e3e8a7f699af8b8" } 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.toml b/src/hyperlight_wasm_macro/Cargo.toml index 516ffae..e58d70a 100644 --- a/src/hyperlight_wasm_macro/Cargo.toml +++ b/src/hyperlight_wasm_macro/Cargo.toml @@ -16,4 +16,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", git = "https://github.com/hyperlight-dev/hyperlight", rev = "172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1" } +hyperlight-component-util = { version = "0.7.0", git = "https://github.com/hyperlight-dev/hyperlight", rev = "abdb96dcdbe96faf2e6b01ab3e3e8a7f699af8b8" } diff --git a/src/wasm_runtime/Cargo.lock b/src/wasm_runtime/Cargo.lock index 9e189ba..ca785e8 100644 --- a/src/wasm_runtime/Cargo.lock +++ b/src/wasm_runtime/Cargo.lock @@ -37,9 +37,9 @@ checksum = "dde20b3d026af13f561bdd0f15edf01fc734f0dafcedbaf42bba506a9517f223" [[package]] name = "autocfg" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] name = "backtrace" @@ -53,7 +53,7 @@ dependencies = [ "miniz_oxide", "object", "rustc-demangle", - "windows-targets", + "windows-targets 0.52.6", ] [[package]] @@ -79,9 +79,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.18.1" +version = "3.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db76d6187cd04dff33004d8e6c9cc4e05cd330500379d2394209271b4aeee" +checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" dependencies = [ "allocator-api2", ] @@ -94,9 +94,9 @@ checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" [[package]] name = "camino" -version = "1.1.10" +version = "1.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0da45bc31171d8d6960122e222a67740df867c1dd53b4d51caa297084c185cab" +checksum = "5d07aa9a93b00c76f71bc35d598bed923f6d4f3a9ca5c24b7737ae1a292841c0" dependencies = [ "serde", ] @@ -126,9 +126,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.26" +version = "1.2.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "956a5e21988b87f372569b66183b78babf23ebc2e744b733e4350a752c4dafac" +checksum = "c3a42d84bb6b69d3a8b3eaacf0d88f179e1929695e1ad012b6cf64d9caaa5fd2" dependencies = [ "shlex", ] @@ -147,9 +147,12 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "cobs" -version = "0.2.3" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" +checksum = "0fa961b519f0b462e3a3b4a34b64d119eeaca1d59af726fe450bbba07a9fc0a1" +dependencies = [ + "thiserror", +] [[package]] name = "cranelift-assembler-x64" @@ -290,9 +293,9 @@ checksum = "8c3d9071bc5ee5573e723d9d84a45b7025a29e8f2c5ad81b3b9d0293129541d9" [[package]] name = "crc32fast" -version = "1.4.2" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" dependencies = [ "cfg-if", ] @@ -343,12 +346,12 @@ checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "errno" -version = "0.3.12" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cea14ef9355e3beab063703aa9dab15afd25f0667c341310c1e5274bb1d0da18" +checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -576,9 +579,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.14" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc2fdfdbff08affe55bb779f33b053aa1fe5dd5b54c257343c17edfa55711bdb" +checksum = "8d9b05277c7e8da2c93a568989bb6207bef0112e8d17df7a6eda4a3cf143bc5e" dependencies = [ "base64", "bytes", @@ -592,7 +595,7 @@ dependencies = [ "libc", "percent-encoding", "pin-project-lite", - "socket2", + "socket2 0.6.0", "tokio", "tower-service", "tracing", @@ -601,7 +604,7 @@ dependencies = [ [[package]] name = "hyperlight-common" version = "0.7.0" -source = "git+https://github.com/hyperlight-dev/hyperlight?rev=172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1#172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1" +source = "git+https://github.com/hyperlight-dev/hyperlight?rev=abdb96dcdbe96faf2e6b01ab3e3e8a7f699af8b8#abdb96dcdbe96faf2e6b01ab3e3e8a7f699af8b8" dependencies = [ "anyhow", "flatbuffers", @@ -612,7 +615,7 @@ dependencies = [ [[package]] name = "hyperlight-component-util" version = "0.7.0" -source = "git+https://github.com/hyperlight-dev/hyperlight?rev=172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1#172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1" +source = "git+https://github.com/hyperlight-dev/hyperlight?rev=abdb96dcdbe96faf2e6b01ab3e3e8a7f699af8b8#abdb96dcdbe96faf2e6b01ab3e3e8a7f699af8b8" dependencies = [ "itertools", "log", @@ -620,24 +623,24 @@ dependencies = [ "proc-macro2", "quote", "syn", - "wasmparser 0.235.0", + "wasmparser 0.236.0", ] [[package]] name = "hyperlight-guest" version = "0.7.0" -source = "git+https://github.com/hyperlight-dev/hyperlight?rev=172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1#172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1" +source = "git+https://github.com/hyperlight-dev/hyperlight?rev=abdb96dcdbe96faf2e6b01ab3e3e8a7f699af8b8#abdb96dcdbe96faf2e6b01ab3e3e8a7f699af8b8" dependencies = [ "anyhow", "hyperlight-common", - "hyperlight-guest-tracing-macro", + "hyperlight-guest-tracing", "serde_json", ] [[package]] name = "hyperlight-guest-bin" version = "0.7.0" -source = "git+https://github.com/hyperlight-dev/hyperlight?rev=172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1#172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1" +source = "git+https://github.com/hyperlight-dev/hyperlight?rev=abdb96dcdbe96faf2e6b01ab3e3e8a7f699af8b8#abdb96dcdbe96faf2e6b01ab3e3e8a7f699af8b8" dependencies = [ "buddy_system_allocator", "cc", @@ -645,7 +648,7 @@ dependencies = [ "glob", "hyperlight-common", "hyperlight-guest", - "hyperlight-guest-tracing-macro", + "hyperlight-guest-tracing", "log", "spin 0.10.0", ] @@ -653,18 +656,18 @@ dependencies = [ [[package]] name = "hyperlight-guest-tracing" version = "0.7.0" -source = "git+https://github.com/hyperlight-dev/hyperlight?rev=172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1#172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1" +source = "git+https://github.com/hyperlight-dev/hyperlight?rev=abdb96dcdbe96faf2e6b01ab3e3e8a7f699af8b8#abdb96dcdbe96faf2e6b01ab3e3e8a7f699af8b8" dependencies = [ "hyperlight-common", + "hyperlight-guest-tracing-macro", "spin 0.10.0", ] [[package]] name = "hyperlight-guest-tracing-macro" version = "0.7.0" -source = "git+https://github.com/hyperlight-dev/hyperlight?rev=172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1#172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1" +source = "git+https://github.com/hyperlight-dev/hyperlight?rev=abdb96dcdbe96faf2e6b01ab3e3e8a7f699af8b8#abdb96dcdbe96faf2e6b01ab3e3e8a7f699af8b8" dependencies = [ - "hyperlight-guest-tracing", "proc-macro2", "quote", "syn", @@ -797,15 +800,26 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.9.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" +checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661" dependencies = [ "equivalent", "hashbrown", "serde", ] +[[package]] +name = "io-uring" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d93587f37623a1a17d94ef2bc9ada592f5465fe7732084ab7beefabe5c77c0c4" +dependencies = [ + "bitflags", + "cfg-if", + "libc", +] + [[package]] name = "ipnet" version = "2.11.0" @@ -855,9 +869,9 @@ checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" [[package]] name = "libc" -version = "0.2.172" +version = "0.2.174" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" +checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776" [[package]] name = "libm" @@ -907,18 +921,18 @@ checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" [[package]] name = "mach2" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b955cdeb2a02b9117f121ce63aa52d08ade45de53e48fe6a38b39c10f6f709" +checksum = "d640282b302c0bb0a2a8e0233ead9035e3bed871f0b7e81fe4a1ec829765db44" dependencies = [ "libc", ] [[package]] name = "memchr" -version = "2.7.4" +version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "memfd" @@ -987,9 +1001,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "postcard" -version = "1.1.1" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "170a2601f67cc9dba8edd8c4870b15f71a6a2dc196daec8c83f72b59dff628a8" +checksum = "6764c3b5dd454e283a30e6dfe78e9b31096d9e32036b5d1eaac7a6119ccb9a24" dependencies = [ "cobs", "embedded-io 0.4.0", @@ -1017,9 +1031,9 @@ dependencies = [ [[package]] name = "prettyplease" -version = "0.2.35" +version = "0.2.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "061c1221631e079b26479d25bbf2275bfe5917ae8419cd7e34f13bfc2aa7539a" +checksum = "ff24dfcda44452b9816fff4cd4227e1bb73ff5a2f1bc1105aa92fb8565ce44d2" dependencies = [ "proc-macro2", "syn", @@ -1079,7 +1093,7 @@ dependencies = [ "quinn-udp", "rustc-hash", "rustls", - "socket2", + "socket2 0.5.10", "thiserror", "tokio", "tracing", @@ -1109,14 +1123,14 @@ dependencies = [ [[package]] name = "quinn-udp" -version = "0.5.12" +version = "0.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee4e529991f949c5e25755532370b8af5d114acae52326361d68d47af64aa842" +checksum = "fcebb1209ee276352ef14ff8732e24cc2b02bbac986cd74a4c81bcb2f9881970" dependencies = [ "cfg_aliases", "libc", "once_cell", - "socket2", + "socket2 0.5.10", "tracing", "windows-sys 0.59.0", ] @@ -1132,15 +1146,15 @@ dependencies = [ [[package]] name = "r-efi" -version = "5.2.0" +version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" [[package]] name = "rand" -version = "0.9.1" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ "rand_chacha", "rand_core", @@ -1181,9 +1195,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.12.20" +version = "0.12.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eabf4c97d9130e2bf606614eb937e86edac8292eaa6f422f995d7e8de1eb1813" +checksum = "cbc931937e6ca3a06e3b6c0aa7841849b160a90351d6ab467a8b9b9959767531" dependencies = [ "base64", "bytes", @@ -1235,9 +1249,9 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.25" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "989e6739f80c4ad5b13e0fd7fe89531180375b18520cc8c82080e4dc4035b84f" +checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace" [[package]] name = "rustc-hash" @@ -1269,22 +1283,22 @@ dependencies = [ [[package]] name = "rustix" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266" +checksum = "11181fbabf243db407ef8df94a6ce0b2f9a733bd8be4ad02b4eda9602296cac8" dependencies = [ "bitflags", "errno", "libc", "linux-raw-sys 0.9.4", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] name = "rustls" -version = "0.23.27" +version = "0.23.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "730944ca083c1c233a75c09f199e973ca499344a2b7ba9e755c457e86fb4a321" +checksum = "c0ebcbd2f03de0fc1122ad9bb24b127a5a6cd51d72604a3f3c50ac459762b6cc" dependencies = [ "once_cell", "ring", @@ -1306,9 +1320,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.103.3" +version = "0.103.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4a72fe2bcf7a6ac6fd7d0b9e5cb68aeb7d4c0a0271730218b3e92d43b4eb435" +checksum = "0a17884ae0c1b773f1ccd2bd4a8c72f16da897310a98b0e84bf349ad5ead92fc" dependencies = [ "ring", "rustls-pki-types", @@ -1364,9 +1378,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.140" +version = "1.0.142" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" +checksum = "030fedb782600dcbd6f02d479bf0d817ac3bb40d644745b769d6a96bc3afc5a7" dependencies = [ "itoa", "memchr", @@ -1394,12 +1408,9 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "slab" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] +checksum = "04dc19736151f35336d325007ac991178d504a119863a2fcb3758cdb5e52c50d" [[package]] name = "smallvec" @@ -1420,6 +1431,16 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "socket2" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "233504af464074f9d066d7b5416c5f9b894a5862a6506e306f7b816cdd6f1807" +dependencies = [ + "libc", + "windows-sys 0.59.0", +] + [[package]] name = "spin" version = "0.9.8" @@ -1543,17 +1564,19 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.45.1" +version = "1.47.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75ef51a33ef1da925cea3e4eb122833cb377c61439ca401b770f54902b806779" +checksum = "89e49afdadebb872d3145a5638b59eb0691ea23e46ca484037cfab3b76b95038" dependencies = [ "backtrace", "bytes", + "io-uring", "libc", "mio", "pin-project-lite", - "socket2", - "windows-sys 0.52.0", + "slab", + "socket2 0.6.0", + "windows-sys 0.59.0", ] [[package]] @@ -1807,9 +1830,9 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.235.0" +version = "0.236.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "161296c618fa2d63f6ed5fffd1112937e803cb9ec71b32b01a76321555660917" +checksum = "16d1eee846a705f6f3cb9d7b9f79b54583810f1fb57a1e3aea76d1742db2e3d2" dependencies = [ "bitflags", "hashbrown", @@ -1851,7 +1874,7 @@ dependencies = [ "postcard", "psm", "pulley-interpreter", - "rustix 1.0.7", + "rustix 1.0.8", "semver", "serde", "serde_derive", @@ -2042,9 +2065,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "1.0.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2853738d1cc4f2da3a225c18ec6c3721abb31961096e9dbf5ab35fa88b19cfdb" +checksum = "7e8983c3ab33d6fb807cfcdad2491c4ea8cbc8ed839181c7dfd9c67c83e261b2" dependencies = [ "rustls-pki-types", ] @@ -2078,13 +2101,19 @@ dependencies = [ "wasmtime-math", ] +[[package]] +name = "windows-link" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" + [[package]] name = "windows-sys" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets", + "windows-targets 0.52.6", ] [[package]] @@ -2093,7 +2122,16 @@ version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ - "windows-targets", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.3", ] [[package]] @@ -2102,14 +2140,31 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm 0.52.6", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.53.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91" +dependencies = [ + "windows-link", + "windows_aarch64_gnullvm 0.53.0", + "windows_aarch64_msvc 0.53.0", + "windows_i686_gnu 0.53.0", + "windows_i686_gnullvm 0.53.0", + "windows_i686_msvc 0.53.0", + "windows_x86_64_gnu 0.53.0", + "windows_x86_64_gnullvm 0.53.0", + "windows_x86_64_msvc 0.53.0", ] [[package]] @@ -2118,48 +2173,96 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" + [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" + [[package]] name = "windows_i686_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" +[[package]] +name = "windows_i686_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" + [[package]] name = "windows_i686_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" + [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_i686_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" + [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" + [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" + [[package]] name = "windows_x86_64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" + [[package]] name = "wit-bindgen-rt" version = "0.39.0" @@ -2219,18 +2322,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.25" +version = "0.8.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1702d9583232ddb9174e01bb7c15a2ab8fb1bc6f227aa1233858c351a3ba0cb" +checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.25" +version = "0.8.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28a6e20d751156648aa063f3800b706ee209a32c0b4d9f24be3d980b01be55ef" +checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181" dependencies = [ "proc-macro2", "quote", @@ -2277,9 +2380,9 @@ dependencies = [ [[package]] name = "zerovec" -version = "0.11.2" +version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a05eb080e015ba39cc9e23bbe5e7fb04d5fb040350f99f34e338d5fdd294428" +checksum = "e7aa2bd55086f1ab526693ecbe444205da57e25f4489879da80635a46d90e73b" dependencies = [ "yoke", "zerofrom", diff --git a/src/wasm_runtime/Cargo.toml b/src/wasm_runtime/Cargo.toml index 10ca96a..9563e8f 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", git = "https://github.com/hyperlight-dev/hyperlight", rev = "172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1", default-features = false } -hyperlight-guest-bin = { version = "0.7.0", git = "https://github.com/hyperlight-dev/hyperlight", rev = "172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1", features = [ "printf" ] } -hyperlight-guest = { version = "0.7.0", git = "https://github.com/hyperlight-dev/hyperlight", rev = "172fcfa69b0f9064c7a0e48e512f8a86ae1fdbe1" } +hyperlight-common = { version = "0.7.0", git = "https://github.com/hyperlight-dev/hyperlight", rev = "abdb96dcdbe96faf2e6b01ab3e3e8a7f699af8b8", default-features = false } +hyperlight-guest-bin = { version = "0.7.0", git = "https://github.com/hyperlight-dev/hyperlight", rev = "abdb96dcdbe96faf2e6b01ab3e3e8a7f699af8b8", features = [ "printf" ] } +hyperlight-guest = { version = "0.7.0", git = "https://github.com/hyperlight-dev/hyperlight", rev = "abdb96dcdbe96faf2e6b01ab3e3e8a7f699af8b8" } wasmtime = { version = "34.0.2", default-features = false, features = [ "runtime", "custom-virtual-memory", "custom-native-signals", "component-model" ] } hyperlight-wasm-macro = { path = "../hyperlight_wasm_macro" } spin = "0.9.8"