`Func::call` aborts on OOM when Wasm traps (with name section) or throws
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 30/100
Research direction
Start with the OOM fuzz target at fuzz/fuzz_targets/oom.rs and the Func::call exception and trap paths described in the issue. Check the linked pull request #15530 for work already underway, then review how exception rooting creates DebugEvents and how wasm_backtrace(true) handles traps. Done means the unnecessary allocation is avoided when no debug handler is registered and the backtrace OOM limitation is documented.
Written by the indexing model from the issue text.
Description
It turns out that Func::call is not quite fully OOM-safe, despite our documentation that says it should be.
There are two ways in which we can still get an OOM:
-
Exception propagation from guest to host, which always does an infallible allocation due to the rooting of the thrown exception.
- The rooting is done in order to create a
DebugEvent, but this is actually unnecessary whenever a debug handler is not registered (i.e., most of the time)!
- The rooting is done in order to create a
-
A trap, when backtraces are enabled (default) and the module has a name section. Maybe this is just a documentation imprecision: we could/should document that Wasm backtrace production is not yet OOM-safe?
This was missed by our OOM-fuzzing because the OOM-fuzzer disables exceptions and does not include a name section in its generated modules.
I believe there are easy fixes for both: (i) conditionally create the DebugEvent for an exception only when a handler is registered (d'oh!), and document that with wasm_backtrace(true), we are not yet OOM-safe.
I'm not sure about the reasoning for disabling exceptions in the fuzzer (here) -- cc @fitzgen on that one?
- Dominant language
- Rust
- Stars
- 18.9k
- Forks
- 2k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 238
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from bytecodealliance/wasmtime
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
bytecodealliance/wasmtime#15536 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
bytecodealliance/wasmtime#15455 · 1 comment ·
Maintainers usually reply within 1 day
-
wasi-preview1-component-adapter: fd_write does not invalidate cached InputStream, causing stale readsPossibly taken @dpfens claimed this 13 days ago. Openwasi
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
bytecodealliance/wasmtime#15296 ·
Maintainers usually reply within 1 day
-
bug wasm-proposal:exceptions wasmtime:debugging
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
bytecodealliance/wasmtime#14102 ·
Maintainers usually reply within 1 day
-
wasm-proposal:gc
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
bytecodealliance/wasmtime#13808 · 2 comments ·
Maintainers usually reply within 1 day
All issues in bytecodealliance/wasmtime
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
valkey-io/valkey-glide#7975 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
marklauter/tsong#110 ·
-
docs enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
wasm-bindgen/wasm-bindgen#5503 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
vortex-data/vortex#12633 ·
Maintainers usually reply within 1 day