-
Notifications
You must be signed in to change notification settings - Fork 142
Remove Allocations from Panic Handler #818
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Remove Allocations from Panic Handler #818
Conversation
Signed-off-by: adamperlin <[email protected]>
using a new FixedStringBuf type backed by a static mut array. Adds a test to verify that StackOverflow no longer occurs on OOM panic Signed-off-by: adamperlin <[email protected]>
Add some docstrings Signed-off-by: adamperlin <[email protected]>
Signed-off-by: adamperlin <[email protected]>
Signed-off-by: adamperlin <[email protected]>
c83158f
to
93e8563
Compare
Signed-off-by: adamperlin <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR addresses issue #735 by removing allocations from the panic handler in the hyperlight guest environment. The implementation introduces a FixedStringBuf
type that wraps a pre-allocated byte slice and implements fmt::Write
to enable string formatting without dynamic allocation.
Key changes:
- Implements a new
FixedStringBuf
type for allocation-free string formatting - Replaces allocation-based panic message handling with a static buffer approach
- Adds test coverage to verify panic handling works correctly under memory exhaustion scenarios
Reviewed Changes
Copilot reviewed 6 out of 10 changed files in this pull request and generated 5 comments.
Show a summary per file
File | Description |
---|---|
src/hyperlight_common/src/fixed_buf.rs |
New module implementing FixedStringBuf for allocation-free string formatting |
src/hyperlight_common/src/lib.rs |
Adds the new fixed_buf module to the crate |
src/hyperlight_guest_bin/src/lib.rs |
Replaces allocation-based panic handler with static buffer implementation |
src/tests/rust_guests/simpleguest/src/main.rs |
Adds heap exhaustion test function to verify panic behavior under OOM conditions |
src/hyperlight_host/tests/integration_test.rs |
Adds integration test to verify panic handler doesn't cause stack overflow |
flake.nix |
Updates cargo hash for build system |
…n panic handler to avoid any possible recursive panic Signed-off-by: adamperlin <[email protected]>
Co-authored-by: Copilot <[email protected]> Signed-off-by: Adam Perlin <[email protected]>
Co-authored-by: Copilot <[email protected]> Signed-off-by: Adam Perlin <[email protected]>
Signed-off-by: adamperlin <[email protected]>
This PR fixes #735. The approach used here is to create a
FixedStringBuf
type which wraps a byte slice and which implementsfmt::Write
by writing into this underlying slice. This static buffer can then be used to format the actual panic message.