Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Build can embed the wrong runtime after switching Pulley feature

未关闭
#545 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 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 内容生成。

描述

lifecycle/needs review

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.

  1. Build and run with an x86 AOT component.
  2. Build and run with the Pulley feature and a Pulley AOT component.
  3. 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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

hyperlight-dev/hyperlight-wasm 的其他 Issue

查看 hyperlight-dev/hyperlight-wasm 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。