Build can embed the wrong runtime after switching Pulley feature
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 55/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- rust, wasm
- 領域
- build-system
調査の方向性
hyperlight-wasm/build.rs から始め、ネストされた runtime の出力と生成された wasm_runtime_resource.rs が OUT_DIR と共有ターゲットパスをどのように使用しているかを調べます。consumer の normal -\u003e pulley -\u003e normal と pulley -\u003e normal -\u003e pulley のシーケンスを再現し、その後、native ビルドと Pulley ビルドを同時実行します。各 AOT コンポーネントが対応する埋め込み runtime でロードされ、同時実行されるビルドが正しく分離されたままになることが完了条件です。
索引モデルが issue の本文から書いたものです。
説明
Summary
Switching between native and Pulley builds can embed the wrong hyperlight-wasm-runtime guest. A native host build can retain the Pulley runtime and reject a valid x86 AOT component:
GuestError(GuestError, "Module was compiled for architecture 'x86_64'")
Reproduction
Use a consumer feature that enables hyperlight-wasm/pulley.
- Build and run with an x86 AOT component.
- Build and run with the Pulley feature and a Pulley AOT component.
- Build and run with the x86 AOT component again.
The third run can reject the x86 component. This reproduces with hyperlight-wasm 0.15.0 and Wasmtime 36.0.14.
Root cause
hyperlight-wasm/build.rs builds the embedded runtime into a shared nested target directory:
<target>/hyperlight-wasm-runtime/x86_64-hyperlight-none/<profile>/hyperlight-wasm-runtime
Native and Pulley Cargo units have separate OUT_DIR directories. Both generated wasm_runtime_resource.rs files use include_bytes! with this shared mutable path.
The nested Pulley build overwrites the runtime binary. Cargo can rebuild the native hyperlight-wasm unit because the include_bytes! input changed while its build script remains cached. The native unit then embeds the Pulley binary.
The shared output also permits a race between concurrent normal and Pulley builds.
Suggested fix
Copy the completed nested runtime into the outer build script's OUT_DIR. Point include_bytes! at that private copy. This preserves the shared nested compilation cache.
Concurrent builds also need one of these protections:
- Hold a lock across the nested build and copy.
- Use a separate nested target directory for each runtime configuration.
The configuration key must cover pulley, gdb, trace_guest, wasmtime_latest, and the WIT environment values. The outer OUT_DIR provides complete isolation but duplicates compilation work.
Regression coverage
Build a consumer in both sequences. Verify that the final component loads:
normal -> pulley -> normal
pulley -> normal -> pulley
Concurrent native and Pulley builds should produce correctly matched embedded runtimes.
- 主要言語
- Rust
- スター
- 728
- フォーク
- 39
- 平均マージ
- 2日 3時間
- マージ済み PR(30日)
- 25
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
hyperlight-dev/hyperlight-wasm のほかの issue
-
lifecycle/needs review
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
-
lifecycle/needs review
難易度 4/5 3〜5日 初心者へのやさしさ 38/100
-
use the #[guest_func] macro on `init_wasm_runtime` instead of manually calling register_function? オープンlifecycle/needs review
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
hyperlight-dev/hyperlight-wasm#395 · コメント 1 件 · リアクション 1 件 ·
-
lifecycle/needs review
難易度 2/5 1〜3時間 初心者へのやさしさ 48/100
-
lifecycle/confirmed
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
hyperlight-dev/hyperlight-wasm#203 · コメント 1 件 ·
hyperlight-dev/hyperlight-wasm の issue をすべて見る
似ている issue
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
yantrikos/yantrik-os#255 ·
-
bug CLI custom-model
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
raphamorim/rio#1956 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
rust-bitcoin/rust-bitcoin#6930 · コメント 1 件 ·