Closed
Labels
fuzz-bugBugs found by a fuzzerwasm-proposal:gcIssues with the implementation of the gc wasm proposal
Description
There's a timeout on oss-fuzz right now in the differential fuzzer. Debugging this it looks like huge arrays are being allocated in wasm and limits aren't kicking into effect. I've verified that the memory limits aren't being exceeded as all allocations fall under our 1G limit for stores.
What appears to be happening is that Cranelift-generated wasm code is taking quite a long time to initialize the array in question. This is under Pulley which is also a slowdown hit too. Differential fuzzing relies on in-wasm fuel counters to ensure execution doesn't take too long and those counters aren't taking into account these "expensive" instructions.
There's a few things I've noticed here and some ideas for solving this:
- Compiled code for
array.new_defaulthas a loop which doesn't contain fuel/epoch checks. That will help in the general case but won't help here because while fuel is enabled for this fuzz test case it's given infinite fuel and relies on in-wasm fuel instead. - Wasm-smith could in theory decrement the size of
array.new_defaultfrom the in-wasm fuel counter before executingarray.new_default, but it doesn't currently. - Host-side allocations of large arrays don't have any await/fuel/epoch checks meaning that large allocations take take a significant chunk of time.
Metadata
Metadata
Assignees
Labels
fuzz-bugBugs found by a fuzzerwasm-proposal:gcIssues with the implementation of the gc wasm proposal
Activity
Consume fuel in `array.new_default`
Consume fuel in `array.new_default` (#11428)
Consume fuel in `array.new_default` (bytecodealliance#11428)
alexcrichton commentedon May 8, 2026
An example of this is:
Natively this takes 4 seconds to execute, and with a 20x slowdown in fuzzing this easily times out. The hot loop is, in pulley bytecode:
which makes sense, this is just a really slow memset.
In differential fuzzing we rely on wasm-smith fuel to limit execution, and wasm-smith's fuel isn't accounting for this loop. Otherwise there's no fuel/epochs happening, which is why this isn't hitting normal timeouts in fuzzing. This is all pulled from https://oss-fuzz.com/testcase-detail/5629900659949568
alexcrichton commentedon May 8, 2026
cc @fitzgen for if you've got thoughts on this
fitzgen commentedon May 12, 2026
I think the answer here is "yes" to all of these. We should also handle
{memory,table}.copysimilarly.fitzgen commentedon May 15, 2026
I think this is fixed by bytecodealliance/wasm-tools#2519 and #13382 although the former needs to be published and updated here, I can start that process.
wasm-smith: Consume fuel for implicit loops (bytecodealliance#2519)