Skip to content
Draft
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
4 changes: 2 additions & 2 deletions .github/workflows/ValidatePullRequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
# See: https://github.com/actions/runner/issues/2205
if: ${{ !cancelled() && !failure() }}
strategy:
fail-fast: true
fail-fast: false
matrix:
hypervisor: ['hyperv-ws2025', mshv3, kvm]
cpu: [amd, intel]
Expand All @@ -112,7 +112,7 @@ jobs:
# See: https://github.com/actions/runner/issues/2205
if: ${{ !cancelled() && !failure() }}
strategy:
fail-fast: true
fail-fast: false
matrix:
hypervisor: ['hyperv-ws2025', mshv3, kvm]
cpu: [amd, intel]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dep_build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ defaults:
jobs:
build-and-test:
if: ${{ inputs.docs_only == 'false' }}
timeout-minutes: 45
timeout-minutes: 60
runs-on: ${{ fromJson(
format('["self-hosted", "{0}", "X64", "1ES.Pool=hld-{1}-{2}"]',
inputs.hypervisor == 'hyperv-ws2025' && 'Windows' || 'Linux',
Expand Down
7 changes: 6 additions & 1 deletion Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ test-integration target=default-target features="":
{{ cargo-cmd }} test {{ if features =="" {"--features executable_heap"} else if features=="no-default-features" {"--no-default-features --features executable_heap"} else {"--no-default-features -F executable_heap," + features } }} --profile={{ if target == "debug" { "dev" } else { target } }} {{ target-triple-flag }} --test integration_test execute_on_heap

@# run the rest of the integration tests
{{ cargo-cmd }} test -p hyperlight-host {{ if features =="" {''} else if features=="no-default-features" {"--no-default-features" } else {"--no-default-features -F " + features } }} --profile={{ if target == "debug" { "dev" } else { target } }} {{ target-triple-flag }} --test '*'
{{ cargo-cmd }} test -p hyperlight-host {{ if features =="" {''} else if features=="no-default-features" {"--no-default-features" } else {"--no-default-features -F " + features } }} --profile={{ if target == "debug" { "dev" } else { target } }} {{ target-triple-flag }} --test '*' -- --nocapture

# tests compilation with no default features on different platforms
test-compilation-no-default-features target=default-target:
Expand Down Expand Up @@ -323,6 +323,11 @@ clippy target=default-target: (witguest-wit)
clippyw target=default-target: (witguest-wit)
{{ cargo-cmd }} clippy --all-targets --all-features --target x86_64-pc-windows-gnu --profile={{ if target == "debug" { "dev" } else { target } }} -- -D warnings

# Cross-check for linux from a windows host using clippy (no linking needed).
# Only checks lib targets to avoid dev-dependencies (criterion->alloca) that need a C cross-compiler.
clippyl target=default-target:
{{ cargo-cmd }} clippy --lib --all-features --target x86_64-unknown-linux-gnu --profile={{ if target == "debug" { "dev" } else { target } }} -- -D warnings

clippy-guests target=default-target: (witguest-wit) (ensure-cargo-hyperlight)
cd src/tests/rust_guests/simpleguest && cargo hyperlight clippy --profile={{ if target == "debug" { "dev" } else { target } }} -- -D warnings
cd src/tests/rust_guests/witguest && cargo hyperlight clippy --profile={{ if target == "debug" { "dev" } else { target } }} -- -D warnings
Expand Down
7 changes: 2 additions & 5 deletions src/hyperlight_guest_bin/src/arch/amd64/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,8 @@ core::arch::global_asm!("
.cfi_startproc
.cfi_undefined rip
jnz flush_done
mov rdi, cr4
xor rdi, 0x80
mov cr4, rdi
xor rdi, 0x80
mov cr4, rdi
mov rdi, cr3
mov cr3, rdi
flush_done:
call {internal_dispatch_function}\n
mov dx, {halt_port}\n
Expand Down
10 changes: 10 additions & 0 deletions src/hyperlight_guest_bin/src/guest_function/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,16 @@ pub(crate) fn internal_dispatch_function() {
};

let handle = unsafe { GUEST_HANDLE };
let canary = unsafe { crate::GUEST_HANDLE_CANARY };

if handle.peb().is_none() || canary != 0xDEAD_BEEF {
panic!(
"GUEST_HANDLE is None! canary={:#x} (expected 0xDEADBEEF), peb={:#x}. \
If canary is also 0, snapshot memory was not restored for this page.",
canary,
handle.peb().map_or(0, |p| p as u64),
);
}

let function_call = handle
.try_pop_shared_input_data_into::<FunctionCall>()
Expand Down
5 changes: 5 additions & 0 deletions src/hyperlight_guest_bin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ pub(crate) static HEAP_ALLOCATOR: ProfiledLockedHeap<32> =
ProfiledLockedHeap(LockedHeap::<32>::empty());

pub static mut GUEST_HANDLE: GuestHandle = GuestHandle::new();
/// Canary value set to 0xDEAD_BEEF during init. If this reads as 0
/// after snapshot restore while GUEST_HANDLE is None, the snapshot
/// memory for this region was not properly restored.
pub static mut GUEST_HANDLE_CANARY: u64 = 0;
pub(crate) static mut REGISTERED_GUEST_FUNCTIONS: GuestFunctionRegister<GuestFunc> =
GuestFunctionRegister::new();

Expand Down Expand Up @@ -205,6 +209,7 @@ pub(crate) extern "C" fn generic_init(
) -> u64 {
unsafe {
GUEST_HANDLE = GuestHandle::init(peb_address as *mut HyperlightPEB);
GUEST_HANDLE_CANARY = 0xDEAD_BEEF;
#[allow(static_mut_refs)]
let peb_ptr = GUEST_HANDLE.peb().unwrap();

Expand Down
8 changes: 6 additions & 2 deletions src/hyperlight_host/src/hypervisor/hyperlight_vm/aarch64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,15 @@ impl HyperlightVm {
unimplemented!("get_snapshot_sregs")
}

pub(crate) fn reset_vcpu(
pub(crate) fn reset_vm_state(&mut self) -> std::result::Result<(), RegisterError> {
unimplemented!("reset_vm_state")
}

pub(crate) fn restore_sregs(
&mut self,
_cr3: u64,
_sregs: &CommonSpecialRegisters,
) -> std::result::Result<(), RegisterError> {
unimplemented!("reset_vcpu")
unimplemented!("restore_sregs")
}
}
Loading
Loading