Skip to content

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

Update the Wasmi differential fuzzing oracle to v1.0 (#12312)

Robin Freyler666d3377d307
diff --git a/Cargo.lock b/Cargo.lock
index e54d55d440..779c1e3511 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4441,9 +4441,9 @@ dependencies = [
[[package]]
name = "wasmi"
-version = "0.51.1"
+version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cb4f6b71d5cb04a4615b9a8a2e522ba284c491ad847afd9e905d89be15e3efc0"
+checksum = "75c97bf74a48796b57fdfe35c00a9fe05410f0f1f8ccfe38591e382a0060a6fd"
dependencies = [
"spin",
"wasmi_collections",
@@ -4454,27 +4454,27 @@ dependencies = [
[[package]]
name = "wasmi_collections"
-version = "0.51.1"
+version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6a4a11fa090c4d742e5a77dbbc8efbbe1aa151db7335ca6850232e6cafbb1023"
+checksum = "fc03d171a00367f89bfb376fe952bb67e337a4992911948c22e1093730a4e718"
dependencies = [
"string-interner",
]
[[package]]
name = "wasmi_core"
-version = "0.51.1"
+version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ab3e422fc1f4df78c9ded6ed48c4ca6d1f55f4609f04c99962fc07532e4db61d"
+checksum = "9f2f829ada3e3fc5d723cd80feb7bbb1ba358ce3a9b069477b3c58c85f892c71"
dependencies = [
"libm",
]
[[package]]
name = "wasmi_ir"
-version = "0.51.1"
+version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "13fe9f9f1747ec81644e764c4dc798f063f5d54a495f0a3b4a375bce9af65399"
+checksum = "a28c3e221277780790bd0abd5c5da440dd39989cd8fa98330a4820d398a7af66"
dependencies = [
"wasmi_core",
]
diff --git a/crates/fuzzing/Cargo.toml b/crates/fuzzing/Cargo.toml
index 9b929297d6..d688e027c4 100644
--- a/crates/fuzzing/Cargo.toml
+++ b/crates/fuzzing/Cargo.toml
@@ -34,7 +34,7 @@ wasm-smith = { workspace = true, features = ['serde'] }
wasm-mutate = { workspace = true }
wasm-compose = { workspace = true }
wasm-spec-interpreter = { path = "./wasm-spec-interpreter", optional = true }
-wasmi = { version = "0.51.1", default-features = false, features = ["std", "simd"] }
+wasmi = { version = "1.0.7", default-features = false, features = ["std", "simd"] }
futures = { workspace = true, features = ['async-await'] }
wasmtime-test-util = { workspace = true, features = ['wast', 'component-fuzz', 'component'] }
serde_json = { workspace = true }
diff --git a/crates/fuzzing/src/oracles/diff_wasmi.rs b/crates/fuzzing/src/oracles/diff_wasmi.rs
index 8e01da029d..8c6e18d49a 100644
--- a/crates/fuzzing/src/oracles/diff_wasmi.rs
+++ b/crates/fuzzing/src/oracles/diff_wasmi.rs
@@ -40,7 +40,7 @@ impl WasmiEngine {
}
}
- fn trap_code(&self, err: &Error) -> Option<wasmi::core::TrapCode> {
+ fn trap_code(&self, err: &Error) -> Option<wasmi::TrapCode> {
let err = err.downcast_ref::<wasmi::Error>()?;
if let Some(code) = err.as_trap_code() {
return Some(code);
@@ -49,12 +49,12 @@ impl WasmiEngine {
match err.kind() {
wasmi::errors::ErrorKind::Instantiation(
wasmi::errors::InstantiationError::ElementSegmentDoesNotFit { .. },
- ) => Some(wasmi::core::TrapCode::TableOutOfBounds),
+ ) => Some(wasmi::TrapCode::TableOutOfBounds),
wasmi::errors::ErrorKind::Memory(wasmi::errors::MemoryError::OutOfBoundsAccess) => {
- Some(wasmi::core::TrapCode::MemoryOutOfBounds)
+ Some(wasmi::TrapCode::MemoryOutOfBounds)
}
wasmi::errors::ErrorKind::Table(wasmi::errors::TableError::CopyOutOfBounds) => {
- Some(wasmi::core::TrapCode::TableOutOfBounds)
+ Some(wasmi::TrapCode::TableOutOfBounds)
}
_ => {
log::trace!("unknown wasmi error: {:?}", err.kind());
@@ -87,16 +87,13 @@ impl DiffEngine for WasmiEngine {
}
fn is_non_deterministic_error(&self, err: &Error) -> bool {
- matches!(
- self.trap_code(err),
- Some(wasmi::core::TrapCode::StackOverflow)
- )
+ matches!(self.trap_code(err), Some(wasmi::TrapCode::StackOverflow))
}
}
/// Converts `wasmi` trap code to `wasmtime` trap code.
-fn wasmi_to_wasmtime_trap_code(trap: wasmi::core::TrapCode) -> Trap {
- use wasmi::core::TrapCode;
+fn wasmi_to_wasmtime_trap_code(trap: wasmi::TrapCode) -> Trap {
+ use wasmi::TrapCode;
match trap {
TrapCode::UnreachableCodeReached => Trap::UnreachableCodeReached,
TrapCode::MemoryOutOfBounds => Trap::MemoryOutOfBounds,
@@ -174,9 +171,9 @@ impl From<&DiffValue> for wasmi::Val {
match *v {
DiffValue::I32(n) => WasmiValue::I32(n),
DiffValue::I64(n) => WasmiValue::I64(n),
- DiffValue::F32(n) => WasmiValue::F32(wasmi::core::F32::from_bits(n)),
- DiffValue::F64(n) => WasmiValue::F64(wasmi::core::F64::from_bits(n)),
- DiffValue::V128(n) => WasmiValue::V128(wasmi::core::V128::from(n)),
+ DiffValue::F32(n) => WasmiValue::F32(wasmi::F32::from_bits(n)),
+ DiffValue::F64(n) => WasmiValue::F64(wasmi::F64::from_bits(n)),
+ DiffValue::V128(n) => WasmiValue::V128(wasmi::V128::from(n)),
DiffValue::FuncRef { null } => {
assert!(null);
WasmiValue::default(wasmi::ValType::FuncRef)