Exception Reference Global Panics Coredump Serialization
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 76/100
Hướng nghiên cứu
Bắt đầu tại crates/wasmtime/src/runtime/coredump.rs, ở WasmCoreDump::_serialize và match của reference-type xung quanh panic đã được báo cáo. Chạy reproducer exnref-coredump.wat được cung cấp bằng lệnh wasmtime đã bật coredump, sau đó xác minh rằng một global exnref không còn đi tới unreachable!() và guest trap không gây ra host panic.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- Rust
- Star
- 18.7k
- Fork
- 1.8k
- Merge trung bình
- 1 ngày 7 giờ
- Pull request đã merge (30 ngày)
- 140
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của bytecodealliance/wasmtime
-
cranelift cranelift:documentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
bytecodealliance/wasmtime#14433 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
cranelift
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
bytecodealliance/wasmtime#14200 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
wasm-proposal:gc
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
bytecodealliance/wasmtime#13808 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add volatile flag to MemFlagsĐang mởcranelift cranelift:area:clif cranelift:goal:optimize-speed enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
bytecodealliance/wasmtime#1598 · 9 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Component Model async runtime may delete still-live subtask handlesCó thể đã có người làm @dicej đã nhận hôm nay. Đang mở
bytecodealliance/wasmtime#14459 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của bytecodealliance/wasmtime
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
stellar/stellar-cli#2773 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
voidzero-dev/oxc-angular-compiler#511 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 86/100
yantrikos/yantrik-os#539 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation station:mac ui-dashboard
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
rolter-ai/rolter#2490 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày