Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
`MultiUseSandbox` from a guest binary on disk, a guest binary in memory, or a
snapshot by @jprendes in https://github.com/hyperlight-dev/hyperlight/pull/1725
* Add `MultiUseSandbox::status()`, which returns `SandboxStatus` for inspecting sandbox lifecycle state (poisoned, unrecoverable).
* Add `MultiUseSandbox::recreate()` for conveniently recreating an unrecoverable sandbox.

### Changed
* **Breaking:** Guest MSR state is now saved and restored across snapshots.
Expand Down
2 changes: 2 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ test-rust-gdb-debugging target=default-target features="":
# rust test for crashdump
test-rust-crashdump target=default-target features="":
{{ cargo-cmd }} test --profile={{ if target == "debug" { "dev" } else { target } }} {{ target-triple-flag }} {{ if features =="" {'--features crashdump'} else { "--features crashdump," + features } }} -- test_crashdump
{{ cargo-cmd }} test --profile={{ if target == "debug" { "dev" } else { target } }} {{ target-triple-flag }} -p hyperlight-host --lib {{ if features =="" {'--features crashdump'} else { "--features crashdump," + features } }} -- sandbox::initialized_multi_use::tests::snapshot_restore_mapping_failure_is_unrecoverable --exact
{{ cargo-cmd }} test --profile={{ if target == "debug" { "dev" } else { target } }} {{ target-triple-flag }} --example crashdump {{ if features =="" {'--features crashdump'} else { "--features crashdump," + features } }}

# rust test for tracing
Expand Down Expand Up @@ -533,6 +534,7 @@ coverage-run hypervisor="kvm": ensure-cargo-llvm-cov

# crashdump tests + example
cargo +nightly test {{ coverage-packages }} --no-default-features --features crashdump,{{ if hypervisor == "mshv3" { "mshv3" } else { "kvm" } }} --tests -- test_crashdump
cargo +nightly test -p hyperlight-host --no-default-features --features crashdump,{{ if hypervisor == "mshv3" { "mshv3" } else { "kvm" } }} --lib -- sandbox::initialized_multi_use::tests::snapshot_restore_mapping_failure_is_unrecoverable --exact
cargo +nightly run --no-default-features --features crashdump,{{ if hypervisor == "mshv3" { "mshv3" } else { "kvm" } }} --example crashdump

# tracing feature tests (host-side only; hyperlight-guest-tracing is no_std)
Expand Down
14 changes: 12 additions & 2 deletions src/hyperlight_host/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,16 @@ pub enum HyperlightError {
#[error("The sandbox was poisoned")]
PoisonedSandbox,

/// The sandbox cannot safely perform further operations and must be discarded.
#[error("The sandbox is unrecoverable and must be discarded")]
/// Recreation requires an unrecoverable sandbox.
#[error("Sandbox recreation requires Unrecoverable status, found {0:?}")]
SandboxRecreationWrongState(crate::SandboxStatus),

/// GDB builds do not support sandbox recreation.
#[error("Sandbox recreation is unsupported when GDB support is enabled")]
SandboxRecreationUnsupported,

/// The sandbox cannot safely perform further operations and must be recreated.
#[error("The sandbox is unrecoverable and must be recreated")]
UnrecoverableSandbox,

/// Raw pointer is less than base address
Expand Down Expand Up @@ -367,6 +375,8 @@ impl HyperlightError {
| HyperlightError::RefCellBorrowFailed(_)
| HyperlightError::RefCellMutBorrowFailed(_)
| HyperlightError::ReturnValueConversionFailure(_, _)
| HyperlightError::SandboxRecreationUnsupported
| HyperlightError::SandboxRecreationWrongState(_)
| HyperlightError::SnapshotLayoutMismatch
| HyperlightError::SnapshotHostFunctionMismatch { .. }
| HyperlightError::SystemTimeError(_)
Expand Down
5 changes: 5 additions & 0 deletions src/hyperlight_host/src/sandbox/host_funcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ impl HostFunctions {
self.0
}

#[cfg(not(gdb))]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is so much stuff not(gdb) guarded?

pub(crate) fn from_inner(inner: FunctionRegistry) -> Self {
Self(inner)
}

/// Borrow the inner registry mutably.
pub(crate) fn inner_mut(&mut self) -> &mut FunctionRegistry {
&mut self.0
Expand Down
Loading
Loading