`Func::call` aborts on OOM when Wasm traps (with name section) or throws

Aperta
#15,529 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@cfallin ci sta già lavorando.

Dal 2/12/2026.

  • #15530 di @cfallin — aperta

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
30/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
rust, wasm
Ambito
backend

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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)!
  • 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?

Lingua principale
Rust
Stelle
18.9k
Fork
2k
Merge medio
1g 6h
PR unite (30g)
238

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di bytecodealliance/wasmtime

Tutte le issue di bytecodealliance/wasmtime

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.