Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Exception Reference Global Panics Coredump Serialization

Aperta Adatta ai principianti
#14,102 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
76/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Tranquilla
Stack tecnologico
rust, wasm
Ambito
backend

Direzione di ricerca

Inizia in crates/wasmtime/src/runtime/coredump.rs, in WasmCoreDump::_serialize e nel match del tipo di riferimento intorno al panic segnalato. Esegui il riproduttore exnref-coredump.wat fornito con il comando wasmtime abilitato per i coredump, quindi verifica che una globale exnref non raggiunga più unreachable!() e che il trap del guest non provochi un panic dell'host.

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

Descrizione

bug wasm-proposal:exceptions wasmtime:debugging

Summary

When WebAssembly coredump capture is enabled, an untrusted module containing a valid exnref global can turn an ordinary guest trap into a Rust panic in the host. Coredump serialization assumes every reference type belongs to the external, function, or anyref families; the exception-reference family reaches an unreachable!() arm instead of being encoded or rejected.

Detail

After the guest traps, WasmCoreDump::_serialize recreates module globals in the core dump. For reference-valued globals it calls r.heap_type().top() and handles only Extern, Func, and Any:

ValType::Ref(r) => match r.heap_type().top() {
    HeapType::Extern => wasm_encoder::ValType::EXTERNREF,
    HeapType::Func => wasm_encoder::ValType::FUNCREF,
    HeapType::Any => wasm_encoder::ValType::Ref(wasm_encoder::RefType::ANYREF),
    ty => unreachable!("not a top type: {ty:?}"),
},

The exception-reference top type is Exn, so a mutable exnref global reaches the final arm. The reproducer enables the existing coredump option and invokes an exported function containing unreachable; no harness or source change is involved.

Reproduce

set -eu
git clone --depth 1 https://github.com/bytecodealliance/wasmtime.git
cd wasmtime
git rev-parse HEAD

cargo build --bin wasmtime --no-default-features \
  --features 'run,wat,cranelift,compile,coredump,clap/default,clap/wrap_help'

cat > exnref-coredump.wat <<'WAT'
(module
  (global (export "g") (mut exnref) (ref.null exn))
  (func (export "trap")
    unreachable))
WAT

set +e
RUST_BACKTRACE=0 ./target/debug/wasmtime run -D coredump=guest.dump \
  --invoke trap exnref-coredump.wat
status=$?
set -e
printf 'exit=%s\n' "$status"

Observed output on the affected HEAD:

3ebfbe5af4927c157d6fcaca42b8dbb6d17b73fb

thread 'main' (...) panicked at crates/wasmtime/src/runtime/coredump.rs:194:31:
internal error: entered unreachable code: not a top type: Exn
exit=101
Lingua principale
Rust
Stelle
18.7k
Fork
1.9k
Merge medio
19h 33m
PR unite (30g)
340

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.