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

オープン
#15,529 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@cfallin がすでに取り組んでいます。

2026年12月2日 から。

  • #15530 @cfallin による — オープン

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
30/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
rust, wasm
領域
backend

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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?

主要言語
Rust
スター
18.9k
フォーク
2k
平均マージ
1日 6時間
マージ済み PR(30日)
238

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

bytecodealliance/wasmtime のほかの issue

bytecodealliance/wasmtime の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。