Skip to content

A lightweight WebAssembly runtime that is fast, secure, and standards-compliant

Fix custom vm + pooling allocator (#14874)

Alex Crichtonc16fd4dee9ae
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index e241990a19..a655f7428c 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -393,6 +393,7 @@ jobs:
-p wasmtime --no-default-features --features debug
-p wasmtime --no-default-features --features debug,gc
-p wasmtime --no-default-features --features runtime,cache
+ -p wasmtime --no-default-features --features runtime,pooling-allocator,custom-virtual-memory --target wasm32-wasip1
-p wasmtime --features incremental-cache
-p wasmtime --features profile-pulley
-p wasmtime --all-features
diff --git a/crates/wasmtime/src/runtime/vm/instance/allocator/pooling/decommit_queue.rs b/crates/wasmtime/src/runtime/vm/instance/allocator/pooling/decommit_queue.rs
index f324631731..a1c218f6d5 100644
--- a/crates/wasmtime/src/runtime/vm/instance/allocator/pooling/decommit_queue.rs
+++ b/crates/wasmtime/src/runtime/vm/instance/allocator/pooling/decommit_queue.rs
@@ -12,7 +12,6 @@ use super::PoolingInstanceAllocator;
use crate::vm::sys::vm::{decommit_pages, iovec};
use crate::vm::{MemoryAllocationIndex, MemoryImageSlot, Table, TableAllocationIndex};
use smallvec::SmallVec;
-use std::io;
#[cfg(feature = "async")]
use wasmtime_fiber::FiberStack;
@@ -147,7 +146,7 @@ impl DecommitQueue {
}
/// Returns if any decommit call failed.
- fn decommit_all_raw(&mut self) -> io::Result<()> {
+ fn decommit_all_raw(&mut self) -> crate::Result<()> {
let iov: &[IoVec] = self.raw.as_slice();
// SAFETY: `IoVec` is `repr(transparent)` over `iovec` so it should be
// safe to reinterpret the slice as the same type.
diff --git a/crates/wasmtime/src/runtime/vm/sys/custom/vm.rs b/crates/wasmtime/src/runtime/vm/sys/custom/vm.rs
index 1d6245634b..60321f5674 100644
--- a/crates/wasmtime/src/runtime/vm/sys/custom/vm.rs
+++ b/crates/wasmtime/src/runtime/vm/sys/custom/vm.rs
@@ -50,13 +50,13 @@ pub unsafe fn decommit_pages(iov: &[iovec]) -> Result<()> {
unsafe {
cvt(capi::wasmtime_mmap_remap(
- iov.iov_addr,
+ iov.iov_base,
iov.iov_len,
capi::PROT_READ | capi::PROT_WRITE,
))?;
}
- Ok(())
}
+ Ok(())
}
pub fn get_page_size() -> usize {