Build can embed the wrong runtime after switching Pulley feature
还没有人认领这个 Issue。
评估
- 难度
- 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 小时
- 30 天内合并 PR
- 25
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 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 个 reaction ·
-
lifecycle/needs review
难度 2/5 1-3 小时 新手友好度 48/100
-
lifecycle/confirmed
难度 5/5 一周以上 新手友好度 30/100
hyperlight-dev/hyperlight-wasm#203 · 1 条评论 ·
查看 hyperlight-dev/hyperlight-wasm 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 88/100
-
bug core
难度 2/5 1-3 小时 新手友好度 86/100
-
JIT-compiled number -> Decimal conversion silently overflows instead of raising DECIMAL_OVERFLOW 未关闭fuzz
难度 2/5 1-3 小时 新手友好度 82/100
ClickHouse/ClickHouse#122114 ·
-
难度 1/5 1 小时以内 新手友好度 92/100
linebender/vello_svg#90 ·
-
难度 2/5 1-3 小时 新手友好度 74/100