From a7d0d00e575d8e866d55e8ca2bdc469b52bc1cb9 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 25 Jan 2023 10:33:26 -0600 Subject: [PATCH] Update wasm-tools crates (#5631) Nothing major pulled in here, but wanted to update to the latest versions which enable tail calls by default. When used in Wasmtime, however, the feature is disabled without the possibility of being enabled since it's not implemented. --- Cargo.lock | 38 ++++++++-------- Cargo.toml | 16 +++---- cranelift/wasm/src/code_translator.rs | 6 +++ crates/fuzzing/src/generators/config.rs | 4 ++ crates/wasmtime/src/config.rs | 5 +++ crates/wasmtime/src/engine/serialization.rs | 8 ++-- supply-chain/audits.toml | 48 +++++++++++++++++++++ 7 files changed, 94 insertions(+), 31 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fc6bda086a..bb3d43101b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3257,18 +3257,18 @@ checksum = "d554b7f530dee5964d9a9468d95c1f8b8acae4f282807e7d27d4b03099a46744" [[package]] name = "wasm-encoder" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29ab2fe77b325731603297debb4573e002d06ae0aa1f4dc108585c81961e0609" +checksum = "ef126be0e14bdf355ac1a8b41afc89195289e5c7179f80118e3abddb472f0810" dependencies = [ "leb128", ] [[package]] name = "wasm-mutate" -version = "0.2.14" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2f8b34ecab2aadb3a974fc96d38a37780793b1a44f9e681ed68f7e69757ca90" +checksum = "dd32bdc265dba5092bf434475b12b9e54dd405938a487bdd86aa41873fbd8532" dependencies = [ "egg", "log", @@ -3280,9 +3280,9 @@ dependencies = [ [[package]] name = "wasm-smith" -version = "0.11.11" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00e76ca2ad5d10fdcd08d9af00ac02585a1e53a60020b0eda8874922f5d49bff" +checksum = "efa1d0e7cff965d746a1f559470bf4d9fbafd34fe11d4e34cfd0c382259bb986" dependencies = [ "arbitrary", "flagset", @@ -3332,9 +3332,9 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.97.0" +version = "0.99.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b98123a0d2bacf9286239231b116cbd66c65d9b89793f7c9bba3a3ae7f1b15f3" +checksum = "9ef3b717afc67f848f412d4f02c127dd3e35a0eecd58c684580414df4fde01d3" dependencies = [ "indexmap", "url", @@ -3351,9 +3351,9 @@ dependencies = [ [[package]] name = "wasmprinter" -version = "0.2.46" +version = "0.2.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "595cca929e47a7bec3c941b5a8e133f51b17e6d9dd8c82ab97902196f5a07b42" +checksum = "27c13dff901f9354fa9a6a877152d9c5642513645985635c9b83bcca99e40ea1" dependencies = [ "anyhow", "wasmparser", @@ -3505,7 +3505,7 @@ dependencies = [ "wasmtime-wasi-crypto", "wasmtime-wasi-nn", "wasmtime-wast", - "wast 51.0.0", + "wast 52.0.2", "wat", "windows-sys", ] @@ -3779,7 +3779,7 @@ dependencies = [ "anyhow", "log", "wasmtime", - "wast 51.0.0", + "wast 52.0.2", ] [[package]] @@ -3814,9 +3814,9 @@ dependencies = [ [[package]] name = "wast" -version = "51.0.0" +version = "52.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f621e6e9af96438d3e05f0699da5b1dae59f2df964a2982166aa9b03c5b599" +checksum = "707a9fd59b0144c530f0a31f21737036ffea6ece492918cae0843dd09b6f9bc9" dependencies = [ "leb128", "memchr", @@ -3826,11 +3826,11 @@ dependencies = [ [[package]] name = "wat" -version = "1.0.53" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dd18c1168d7e8743d9b4f713c0203924f5dcc4a3983eb5e584de9614f9fccde" +checksum = "91d73cbaa81acc2f8a3303e2289205c971d99c89245c2f56ab8765c4daabc2be" dependencies = [ - "wast 51.0.0", + "wast 52.0.2", ] [[package]] @@ -4069,9 +4069,9 @@ dependencies = [ [[package]] name = "wit-parser" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02cfa79275011530f37e0e164183c606bae1cdc466ea90bcd364d50605486a4d" +checksum = "2e60c4242d4cf4394fac7587c0d96c39b3c0fb09e638815c3f244f6bb5356f04" dependencies = [ "anyhow", "id-arena", diff --git a/Cargo.toml b/Cargo.toml index e72cddff16..c37359a72f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -161,14 +161,14 @@ winch-test-macros = { path = "winch/test-macros" } target-lexicon = { version = "0.12.3", default-features = false, features = ["std"] } anyhow = "1.0.22" -wasmparser = "0.97.0" -wat = "1.0.53" -wast = "51.0.0" -wasmprinter = "0.2.46" -wasm-encoder = "0.21.0" -wasm-smith = "0.11.11" -wasm-mutate = "0.2.14" -wit-parser = "0.4" +wasmparser = "0.99.0" +wat = "1.0.56" +wast = "52.0.2" +wasmprinter = "0.2.49" +wasm-encoder = "0.22.0" +wasm-smith = "0.12.0" +wasm-mutate = "0.2.16" +wit-parser = "0.4.1" windows-sys = "0.42.0" env_logger = "0.9" rustix = "0.36.7" diff --git a/cranelift/wasm/src/code_translator.rs b/cranelift/wasm/src/code_translator.rs index 0d86ffa7b2..81f9ee886d 100644 --- a/cranelift/wasm/src/code_translator.rs +++ b/cranelift/wasm/src/code_translator.rs @@ -2117,6 +2117,12 @@ pub fn translate_operator( Operator::ReturnCall { .. } | Operator::ReturnCallIndirect { .. } => { return Err(wasm_unsupported!("proposed tail-call operator {:?}", op)); } + Operator::MemoryDiscard { .. } => { + return Err(wasm_unsupported!( + "proposed memory-control operator {:?}", + op + )); + } Operator::I8x16RelaxedSwizzle | Operator::I32x4RelaxedTruncSatF32x4S | Operator::I32x4RelaxedTruncSatF32x4U diff --git a/crates/fuzzing/src/generators/config.rs b/crates/fuzzing/src/generators/config.rs index c3016fa6c1..11e52f9469 100644 --- a/crates/fuzzing/src/generators/config.rs +++ b/crates/fuzzing/src/generators/config.rs @@ -311,6 +311,10 @@ impl<'a> Arbitrary<'a> for Config { module_config: u.arbitrary()?, }; + // This is pulled from `u` by default via `wasm-smith`, but Wasmtime + // doesn't implement this yet, so forcibly always disable it. + config.module_config.config.tail_call_enabled = false; + config .wasmtime .codegen diff --git a/crates/wasmtime/src/config.rs b/crates/wasmtime/src/config.rs index 88622bc312..2f699450f6 100644 --- a/crates/wasmtime/src/config.rs +++ b/crates/wasmtime/src/config.rs @@ -198,6 +198,11 @@ impl Config { ret.wasm_bulk_memory(true); ret.wasm_simd(true); ret.wasm_backtrace_details(WasmBacktraceDetails::Environment); + + // This is on-by-default in `wasmparser` since it's a stage 4+ proposal + // but it's not implemented in Wasmtime yet so disable it. + ret.features.tail_call = false; + ret } diff --git a/crates/wasmtime/src/engine/serialization.rs b/crates/wasmtime/src/engine/serialization.rs index 731e4d2c97..ad15847bd0 100644 --- a/crates/wasmtime/src/engine/serialization.rs +++ b/crates/wasmtime/src/engine/serialization.rs @@ -163,7 +163,6 @@ struct WasmFeatures { component_model: bool, simd: bool, threads: bool, - tail_call: bool, multi_memory: bool, exceptions: bool, memory64: bool, @@ -187,6 +186,7 @@ impl Metadata { memory64, relaxed_simd, extended_const, + memory_control, // Always on; we don't currently have knobs for these. mutable_global: _, @@ -195,6 +195,9 @@ impl Metadata { floats: _, } = engine.config().features; + assert!(!memory_control); + assert!(!tail_call); + Metadata { target: engine.compiler().triple().to_string(), shared_flags: engine.compiler().flags(), @@ -207,7 +210,6 @@ impl Metadata { component_model, simd, threads, - tail_call, multi_memory, exceptions, memory64, @@ -372,7 +374,6 @@ impl Metadata { component_model, simd, threads, - tail_call, multi_memory, exceptions, memory64, @@ -402,7 +403,6 @@ impl Metadata { )?; Self::check_bool(simd, other.simd, "WebAssembly SIMD support")?; Self::check_bool(threads, other.threads, "WebAssembly threads support")?; - Self::check_bool(tail_call, other.tail_call, "WebAssembly tail-call support")?; Self::check_bool( multi_memory, other.multi_memory, diff --git a/supply-chain/audits.toml b/supply-chain/audits.toml index e4054b4378..87eecfae99 100644 --- a/supply-chain/audits.toml +++ b/supply-chain/audits.toml @@ -619,6 +619,12 @@ criteria = "safe-to-deploy" version = "0.21.0" notes = "The Bytecode Alliance is the author of this crate." +[[audits.wasm-encoder]] +who = "Alex Crichton " +criteria = "safe-to-deploy" +version = "0.22.0" +notes = "The Bytecode Alliance is the author of this crate." + [[audits.wasm-encoder]] who = "Alex Crichton " criteria = "safe-to-deploy" @@ -685,6 +691,12 @@ criteria = "safe-to-run" version = "0.2.14" notes = "The Bytecode Alliance is the author of this crate." +[[audits.wasm-mutate]] +who = "Alex Crichton " +criteria = "safe-to-run" +version = "0.2.16" +notes = "The Bytecode Alliance is the author of this crate." + [[audits.wasm-smith]] who = "Alex Crichton " criteria = "safe-to-deploy" @@ -745,6 +757,12 @@ criteria = "safe-to-run" version = "0.11.11" notes = "The Bytecode Alliance is the author of this crate." +[[audits.wasm-smith]] +who = "Alex Crichton " +criteria = "safe-to-run" +version = "0.12.0" +notes = "The Bytecode Alliance is the author of this crate." + [[audits.wasmi]] who = "Robin Freyler " criteria = "safe-to-run" @@ -853,6 +871,12 @@ criteria = "safe-to-deploy" version = "0.97.0" notes = "The Bytecode Alliance is the author of this crate." +[[audits.wasmparser]] +who = "Alex Crichton " +criteria = "safe-to-deploy" +version = "0.99.0" +notes = "The Bytecode Alliance is the author of this crate." + [[audits.wasmparser-nostd]] who = "Alex Crichton " criteria = "safe-to-run" @@ -924,6 +948,12 @@ criteria = "safe-to-deploy" version = "0.2.46" notes = "The Bytecode Alliance is the author of this crate." +[[audits.wasmprinter]] +who = "Alex Crichton " +criteria = "safe-to-deploy" +version = "0.2.49" +notes = "The Bytecode Alliance is the author of this crate." + [[audits.wast]] who = "Alex Crichton " criteria = "safe-to-deploy" @@ -984,6 +1014,12 @@ criteria = "safe-to-deploy" version = "51.0.0" notes = "The Bytecode Alliance is the author of this crate." +[[audits.wast]] +who = "Alex Crichton " +criteria = "safe-to-deploy" +version = "52.0.2" +notes = "The Bytecode Alliance is the author of this crate." + [[audits.wat]] who = "Alex Crichton " criteria = "safe-to-deploy" @@ -1026,6 +1062,12 @@ criteria = "safe-to-deploy" version = "1.0.53" notes = "The Bytecode Alliance is the author of this crate." +[[audits.wat]] +who = "Alex Crichton " +criteria = "safe-to-deploy" +version = "1.0.56" +notes = "The Bytecode Alliance is the author of this crate." + [[audits.wat]] who = "Alex Crichton " criteria = "safe-to-deploy" @@ -1104,3 +1146,9 @@ criteria = "safe-to-deploy" version = "0.4.0" notes = "The Bytecode Alliance is the author of this crate." +[[audits.wit-parser]] +who = "Alex Crichton " +criteria = "safe-to-deploy" +version = "0.4.1" +notes = "The Bytecode Alliance is the author of this crate." +