[WASM][WasmSmith] Assertion failure !gIsWasmSmith || !error at testWasm.cpp:289 (Validation Mismatch)
Categories
(Core :: JavaScript: WebAssembly, defect, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox158 | --- | fixed |
People
(Reporter: uncleruc2075, Assigned: uncleruc2075)
References
(Blocks 1 open bug)
Details
Attachments
(1 file, 1 external file)
|
12 bytes,
text/plain
|
Details |
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36
Steps to reproduce:
- Use a SpiderMonkey build with WasmSmith fuzzer support enabled.
- Run the fuzz-tests binary with the WasmSmith target using the attached 12-byte crash file:
Actual results:
The process crashed due to an assertion failure in the fuzzer harness:
Assertion failure: !gIsWasmSmith || !error, at checkouts/gecko/js/src/fuzz-tests/testWasm.cpp:289
This indicates that the CompileModule function returned a validation error for a module generated by wasm-smith. Since wasm-smith is intended to generate only valid WebAssembly modules, this
assertion failure reveals a "Validation Mismatch" between the generator and the SpiderMonkey engine.
What should have happened? (expected results)
WebAssembly modules generated by wasm-smith should be considered valid by the SpiderMonkey engine and should not trigger validation errors or assertion failures in the fuzzer harness.
Expected results:
WebAssembly modules generated by wasm-smith should be considered valid by the SpiderMonkey engine and should not trigger validation errors or assertion failures in the fuzzer harness.
| Assignee | ||
Comment 1•6 months ago
|
||
FUZZER=WasmSmith ./fuzz-tests crash-d5d73b76950621acd2928c573383cb68c84ab795
Updated•6 months ago
|
| Assignee | ||
Comment 2•6 months ago
|
||
This error occurs quite frequently and prevents the fuzzing process from working properly.
Updated•5 months ago
|
Comment 3•5 months ago
|
||
I ran the fuzzer on that file and extracted the wasm module. This is what we have:
ryanhunt@Ryans-MacBook-Pro wasmsmith-crash % wasm-tools print out.wasm
(module
(import "" "" (memory (;0;) i64 280376103141120))
)
ryanhunt@Ryans-MacBook-Pro wasmsmith-crash % ./mach run
Creating the 'common' site at /Users/ryanhunt/.mozbuild/srcdirs/wasmsmith-crash-01e9c25d76d4/_virtualenvs/common
0:00.41 /Users/ryanhunt/src/firefox/wasmsmith-crash/obj-shell/dist/bin/js
js> let b = wasmTextToBinary(`(module
(import "" "" (memory (;0;) i64 280376103141120))
)`);
js> WebAssembly.validate(b);
false
It looks like we're failing to validate a really big wasm memory. The issue is that we restrict a memory max bytes to be within MAX_SAFE_INTEGER during validation [1].
It's ambiguous if this is correct or not, and this PR will move this from a validation error to an instantiation error [2]. But this is not a serious validation issue. We could change the Config we pass to wasm-smith to workaround this issue [3].
[1] https://searchfox.org/firefox-main/rev/a49121972a6140a227e2d0d585afbce3f9e5e11a/js/src/wasm/WasmMemory.h#187-199
[2] https://github.com/WebAssembly/spec/pull/2089
[3] https://docs.rs/wasm-smith/0.250.0/wasm_smith/struct.Config.html#structfield.max_memory64_bytes
| Assignee | ||
Comment 4•2 months ago
|
||
Updated•2 months ago
|
Comment 6•2 months ago
|
||
| bugherder | ||
Updated•1 month ago
|
Description
•