Repository navigation
Run guard page crash tests on Windows - #1899
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The subprocess checks, platform gates, and dependency cleanup are consistent and complete.
0 open findings
What changed in this PR
Enables ExclusiveSharedMemory guard page crash tests on Windows using isolated test subprocesses.
Changes:
- Reuses a shared subprocess test harness.
- Detects Linux signals and Windows access violations.
- Removes the unused direct signal hook dependency.
| File | Description |
|---|---|
src/hyperlight_host/src/mem/shared_mem.rs |
Adds cross-platform guard page crash testing. |
src/hyperlight_host/Cargo.toml |
Removes the unused dev dependency. |
Cargo.lock |
Removes the direct dependency edge. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
ludfjig
left a comment
There was a problem hiding this comment.
thanks a lot for this, this is great!
This comment has been minimized.
This comment has been minimized.
|
@DanielTangnes looks like CI is failing. If you could address the formatting and then rebase I'd be happy to merge this :) |
The read, write and exec guard page tests rerun the test binary with --exact and check its exit status using the helpers from the from_file guard tests. That works on Windows, where the SIGSEGV hook can't, and keeps the child on the same build profile as the parent. Drop the signal-hook-registry dev-dependency. These tests were its only user. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011CnFoNrC4zWqRUqoeDzS6P Signed-off-by: danieltangnes <danieltangnes1@gmail.com>
edca0d5 to
7bd0b1a
Compare
|
@ludfjig Should be good to go now :) |
Benchmark ResultsMeasured commit: kvm / amd (Linux) (➖ stable)No benchmark improved or regressed. Benchmark Resultsfunction_call_codec
payload_allocation
sandboxes
slot_pool
snapshot_files
virtq_readonly
virtq_readwrite
kvm / intel (Linux) (➖ stable)No benchmark improved or regressed. Benchmark Resultsfunction_call_codec
payload_allocation
sandboxes
slot_pool
snapshot_files
virtq_readonly
virtq_readwrite
mshv3 / amd (Linux) (➖ stable)No benchmark improved or regressed. Benchmark Resultsfunction_call_codec
payload_allocation
sandboxes
slot_pool
snapshot_files
virtq_readonly
virtq_readwrite
mshv3 / intel (Linux) (➖ stable)No benchmark improved or regressed. Benchmark Resultsfunction_call_codec
payload_allocation
sandboxes
slot_pool
snapshot_files
virtq_readonly
virtq_readwrite
hyperv-ws2025 / amd (Windows) (➖ stable)No benchmark improved or regressed. Benchmark Resultsfunction_call_codec
payload_allocation
sandboxes
slot_pool
snapshot_files
virtq_readonly
virtq_readwrite
hyperv-ws2025 / intel (Windows) (➖ stable)No benchmark improved or regressed. Benchmark Resultsfunction_call_codec
payload_allocation
sandboxes
slot_pool
snapshot_files
virtq_readonly
virtq_readwrite
Reported by |
Fixes #1508
guard_page_crash_test(read/write/exec on the leading guard page ofExclusiveSharedMemory) runs on Linux and Windows. It uses the subprocess approach from #1498.What changed:
test_path,run_guard_page_subprocessandkilled_by_access_violationlive in a smallguard_page_subprocesstest module that both shims use. The bodies are unchanged, sogit diff --color-movedshows them as a move.reached_guard/survived_guardaround the bad access. The shim reruns the current test binary with--ignored --exactfor each one.all(not(miri), any(target_os = "linux", windows)).signal-hook-registrydev-dependency. The SIGSEGV hook in these tests was its only user.A side effect on Linux: the old shim spawned
cargo testwithout--profile, so underjust test releaseit rebuilt and checked a debug binary. Rerunningcurrent_exe()keeps the child on the parent's profile and skips the extra build.I left macOS out to match the issue.
from_file_testsalready runs there, but I couldn't check which signal theexeccase raises on Apple silicon. Happy to widen the gate if you want it.Test-only change, so no changelog entry.
Testing (Linux x86_64, KVM host):
cargo test -p hyperlight-host --lib -- mem::shared_mem::tests: 28 passed, 5 ignoredcargo test -p hyperlight-host --profile=release --lib -- guard_page: both shims passPROT_READ | PROT_WRITE, the shim fails withsurvived=true(reverted afterwards)shared_mem.rs. I ran these with a 1.98 toolchain rather than the pinned 1.94 and nightly rustfmt, so CI is the real check.just miri-tests, fulljust test. The Windows run comes from CI.Could a maintainer add
kind/enhancement? I can't set labels from a fork.🤖 Generated with Claude Code