Skip to content

[test do not merge] snapshot golden tests#1446

Draft
ludfjig wants to merge 2 commits into
hyperlight-dev:mainfrom
ludfjig:snapshot-golden-tests
Draft

[test do not merge] snapshot golden tests#1446
ludfjig wants to merge 2 commits into
hyperlight-dev:mainfrom
ludfjig:snapshot-golden-tests

Conversation

@ludfjig

@ludfjig ludfjig commented May 8, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@ludfjig ludfjig added regen-goldens Regenerate snapshot golden fixtures and removed regen-goldens Regenerate snapshot golden fixtures labels May 8, 2026
@ludfjig ludfjig force-pushed the snapshot-golden-tests branch 2 times, most recently from db6f7fb to b5a0b52 Compare June 8, 2026 23:34
@ludfjig ludfjig force-pushed the snapshot-golden-tests branch from b5a0b52 to cc3e7f8 Compare June 18, 2026 16:33
A guest exception handler runs on the IST1 stack. If the handler writes
a copy-on-write page, the first write faults. The page fault also uses
IST1, so the CPU resets RSP to the top of IST1 and writes the fault
frame over the live handler frame. The handler then returns to a bad
address and the guest aborts.

The bug stays latent until an exception handler writes a copy-on-write
page. It surfaced when a memory layout change moved a counter that an
existing handler increments onto a page that stays copy-on-write after a
snapshot. The increment then faulted while the handler ran and crashed
the guest.

Send page faults to their own IST2 stack so a fault inside a handler
keeps the handler frame intact. The page-fault stack uses the second of
the two scratch pages already reserved at the top of the region.

Add a regression test, exception_handler_nested_page_fault. It installs
a handler that writes a copy-on-write page, then triggers int3. Without
the fix the guest aborts with a page fault. With the fix it returns 0.

Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
@ludfjig ludfjig force-pushed the snapshot-golden-tests branch from cc3e7f8 to 9e44b28 Compare June 23, 2026 21:19
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
@ludfjig ludfjig force-pushed the snapshot-golden-tests branch from 9e44b28 to faa02a8 Compare June 24, 2026 02:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

regen-goldens Regenerate snapshot golden fixtures

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant