Element segment expressions are evaluated interleaved with table writes during instantiation
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Reproduce both snippets with cargo run -- wast foo.wast, then follow the module-instantiation path in the wasmtime crate to where element segment expressions are evaluated and active segments run table.init. The spec order (all expressions evaluated first, then table writes) has to be reflected there, and the change must keep the fast path for the common case. Done when both scripts trap as expected and imported tables are untouched after the trap; run the existing wast spec tests for element segments and tables.
索引モデルが issue の本文から書いたものです。
説明
This test:
(module $M
(type $t (func (result i32)))
(table (export "t") 2 funcref)
(table (export "a") 2 anyref)
(func (export "call") (param i32) (result i32)
(call_indirect (type $t) (local.get 0)))
(func (export "get-a") (param i32) (result i32)
(i31.get_s (ref.cast (ref i31) (table.get 1 (local.get 0))))))
(register "M" $M)
(assert_trap
(module
(type $a (array (mut i64)))
(import "M" "t" (table 2 funcref))
(table $t2 1 anyref)
(func $f (result i32) (i32.const 7))
(elem (table 0) (i32.const 0) func $f)
(elem (table $t2) (i32.const 0) anyref
(array.new_default $a (i32.const 0x7fffffff))))
"allocation size too large")
(assert_trap (invoke $M "call" (i32.const 0)) "uninitialized element")
fails with:
$ cargo run -- wast foo.wast
Error: failed to run script file 'foo.wast'
Caused by:
0: failed directive on foo.wast:21
1: expected trap, got Core([I32(7)])
and the same with the trap in a later element of the same segment:
(assert_trap
(module
(type $a (array (mut i64)))
(import "M" "a" (table 2 anyref))
(elem (table 0) (i32.const 0) anyref
(ref.i31 (i32.const 5))
(array.new_default $a (i32.const 0x7fffffff))))
"allocation size too large")
(assert_trap (invoke $M "get-a" (i32.const 0)) "null reference")
$ cargo run -- wast foo.wast
Error: failed to run script file 'foo.wast'
Caused by:
0: failed directive on foo.wast:19
1: expected trap, got Core([I32(5)])
The spec's instantiation evaluates the element expressions of every segment before running any active segment's table.init, so a trapping expression should leave imported tables untouched.
Fixing this in my opinion is going to need to be balanced with implementation complexity. This is a vanishingly niche use case which in theory shouldn't come along with a large implementation burden. Nevertheless I figured it's worth opening here.
- 主要言語
- Rust
- スター
- 18.8k
- フォーク
- 1.9k
- 平均マージ
- 23時間 57分
- マージ済み PR(30日)
- 392
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
bytecodealliance/wasmtime のほかの issue
-
bug wasm-proposal:exceptions wasmtime:debugging
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
bytecodealliance/wasmtime#14102 ·
メンテナーはふだん 1 日以内に返信
-
wasm-proposal:gc
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
bytecodealliance/wasmtime#13808 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
Cranelift: Alias analysis panic with `compute_observed_stores`対応中かも @fitzgen が今日担当しました。 オープンbug cranelift
bytecodealliance/wasmtime#15053 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
bug wasi-http
難易度 3/5 1〜2日 初心者へのやさしさ 32/100
bytecodealliance/wasmtime#15026 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Proposal to rework `MemoryCreator` and remove internal types.対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンwasmtime:api
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
bytecodealliance/wasmtime#14989 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
bytecodealliance/wasmtime の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
BurntSushi/jiff#668 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
router-for-me/EasyCLIProxyAPI#534 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
astral-sh/astral-codec#244 ·
メンテナーはふだん 1 日以内に返信
-
ready-for-agent
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
bug dependencies kind:fix priority: P3 ready-for-agent
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
shep-pm/shep#1318 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信