Add AArch64 guest exception callback - #1771
Closed
jsturtevant wants to merge 1 commit into
Closed
Conversation
Signed-off-by: James Sturtevant <jsturtevant@gmail.com>
jsturtevant
requested review from
andreiltd,
danbugs,
dblnz,
devigned,
jprendes,
ludfjig,
simongdavies,
squillace and
syntactically
as code owners
August 26, 2026 13:25
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an AArch64-specific guest exception callback hook in hyperlight_guest_bin so guest runtimes can intercept synchronous exceptions, adjust ELR and saved GPRs, and resume execution before Hyperlight falls back to its default abort path. This preserves Hyperlight’s existing stack-growth and CoW fault handling while enabling runtime-specific trap and fault recovery.
Changes:
- Expose a public, arch-specific exception interface module and add AArch64 exports for registering an exception callback.
- Make the AArch64 exception module visible within the crate so the new public re-exports can reach the handler registration functions.
- Invoke the registered AArch64 callback from the synchronous exception handler after Hyperlight internal fault handling and before abort.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/hyperlight_guest_bin/src/lib.rs | Makes the arch-specific exception interface available via a stable exception module. |
| src/hyperlight_guest_bin/src/exception.rs | Adds AArch64-specific public exports for the exception callback registration API. |
| src/hyperlight_guest_bin/src/arch/aarch64/mod.rs | Adjusts module visibility so the crate can re-export AArch64 exception handler registration. |
| src/hyperlight_guest_bin/src/arch/aarch64/exception/handle.rs | Implements callback registration and calls it from the synchronous exception path, allowing ELR and register edits before eret. |
| CHANGELOG.md | Documents the new AArch64 guest exception callback capability. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+18
to
+23
| /// Callback for synchronous AArch64 exceptions not handled by Hyperlight. | ||
| /// | ||
| /// The arguments are the decoded exception, raw ESR_EL1, FAR_EL1, mutable | ||
| /// ELR_EL1, and saved x0 through x30. Return `true` to resume execution. | ||
| /// Call [`crate::paging::barrier::first_valid_same_ctx`] after mapping a page | ||
| /// for a translation fault. |
Comment on lines
+28
to
+32
| /// Register the callback for synchronous AArch64 exceptions. | ||
| /// | ||
| /// A new callback replaces any existing callback. | ||
| pub fn register_exception_handler(handler: ExceptionHandler) { | ||
| HANDLER.store(handler as usize as u64, Ordering::Release); |
Member
|
Actually, this was purposefully left out in favour of #1690 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an AArch64-specific guest exception callback before Hyperlight's default abort. This enables guest runtimes such as Wasmtime to resolve lazy translation faults or redirect hardware traps while preserving Hyperlight's stack and CoW fault handling.
The callback receives the decoded exception, raw ESR and FAR, mutable ELR, and saved x0 through x30 registers.