-
Notifications
You must be signed in to change notification settings - Fork 123
petri: Disable secure boot by default for HyperV tests and introduce specific secureboot tests #1386
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
Open
maheeraeron
wants to merge
10
commits into
microsoft:main
Choose a base branch
from
maheeraeron:user/maheeraeron/secureboot-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
petri: Disable secure boot by default for HyperV tests and introduce specific secureboot tests #1386
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
769124a
Initial commit: Add ca template function and without secure boot
maheeraeron 9b570b0
Add secure_boot_template field to PetriConfigOpenVmm
maheeraeron 295f36c
Revert return statement in PetriVmConfigOpenVmm::new()
maheeraeron fd217f2
Revert plumbing and add new with_* functions
maheeraeron 13bf127
Resolve secure boot templates with with_secure_boot(), disable on def…
maheeraeron 6b57eb9
Only enable linux uefi tests for now
maheeraeron 90b3454
Restrict secure-boot disabling to gen2, expand secure boot test profiles
maheeraeron 9c1f5f4
Panic on unsupported secure_boot os flavors
maheeraeron e0262a4
Fix enum variant name
maheeraeron 2602339
Modify secure boot test to wait for successful boot event, add negati…
maheeraeron File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,6 +67,69 @@ async fn boot(config: Box<dyn PetriVmConfig>) -> anyhow::Result<()> { | |
Ok(()) | ||
} | ||
|
||
/// Basic boot test with secure boot enabled. | ||
#[vmm_test( | ||
openvmm_uefi_aarch64(vhd(ubuntu_2404_server_aarch64)), | ||
openvmm_uefi_x64(vhd(windows_datacenter_core_2022_x64)), | ||
openvmm_uefi_x64(vhd(ubuntu_2204_server_x64)), | ||
openvmm_openhcl_uefi_x64(vhd(windows_datacenter_core_2022_x64)), | ||
openvmm_openhcl_uefi_x64(vhd(ubuntu_2204_server_x64)), | ||
hyperv_uefi_aarch64(vhd(windows_11_enterprise_aarch64)), | ||
hyperv_uefi_aarch64(vhd(ubuntu_2404_server_aarch64)), | ||
hyperv_uefi_x64(vhd(windows_datacenter_core_2022_x64)), | ||
hyperv_uefi_x64(vhd(ubuntu_2204_server_x64)), | ||
hyperv_openhcl_uefi_aarch64(vhd(windows_11_enterprise_aarch64)), | ||
hyperv_openhcl_uefi_aarch64(vhd(ubuntu_2404_server_aarch64)), | ||
hyperv_openhcl_uefi_x64(vhd(windows_datacenter_core_2022_x64)), | ||
hyperv_openhcl_uefi_x64(vhd(ubuntu_2204_server_x64)) | ||
)] | ||
async fn secure_boot(config: Box<dyn PetriVmConfig>) -> anyhow::Result<()> { | ||
let mut vm = config.with_secure_boot().run_without_agent().await?; | ||
vm.wait_for_successful_boot_event().await?; | ||
assert_eq!(vm.wait_for_teardown().await?, HaltReason::PowerOff); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is telling these vms to shut down? You probably need to add a call to enlightened_shutdown |
||
Ok(()) | ||
} | ||
|
||
/// Verify that Windows UEFI guests fail with a mismatched secure boot template. | ||
#[vmm_test( | ||
openvmm_uefi_x64(vhd(windows_datacenter_core_2022_x64)), | ||
openvmm_openhcl_uefi_x64(vhd(windows_datacenter_core_2022_x64)), | ||
hyperv_uefi_aarch64(vhd(windows_11_enterprise_aarch64)), | ||
hyperv_uefi_x64(vhd(windows_datacenter_core_2022_x64)), | ||
hyperv_openhcl_uefi_aarch64(vhd(windows_11_enterprise_aarch64)), | ||
hyperv_openhcl_uefi_x64(vhd(windows_datacenter_core_2022_x64)) | ||
)] | ||
async fn mismatched_secure_boot_template_windows( | ||
config: Box<dyn PetriVmConfig>, | ||
) -> anyhow::Result<()> { | ||
let mut vm = config.with_uefi_ca_template().run_without_agent().await?; | ||
assert_eq!(vm.wait_for_boot_event().await?, FirmwareEvent::BootFailed); | ||
assert_eq!(vm.wait_for_teardown().await?, HaltReason::PowerOff); | ||
Ok(()) | ||
} | ||
|
||
/// Verify that Linux UEFI guests fail with a mismatched secure boot template. | ||
#[vmm_test( | ||
openvmm_uefi_aarch64(vhd(ubuntu_2404_server_aarch64)), | ||
openvmm_uefi_x64(vhd(ubuntu_2204_server_x64)), | ||
openvmm_openhcl_uefi_x64(vhd(ubuntu_2204_server_x64)), | ||
hyperv_uefi_aarch64(vhd(ubuntu_2404_server_aarch64)), | ||
hyperv_uefi_x64(vhd(ubuntu_2204_server_x64)), | ||
hyperv_openhcl_uefi_aarch64(vhd(ubuntu_2404_server_aarch64)), | ||
hyperv_openhcl_uefi_x64(vhd(ubuntu_2204_server_x64)) | ||
)] | ||
async fn mismatched_secure_boot_template_linux( | ||
config: Box<dyn PetriVmConfig>, | ||
) -> anyhow::Result<()> { | ||
let mut vm = config | ||
.with_windows_secure_boot_template() | ||
.run_without_agent() | ||
.await?; | ||
assert_eq!(vm.wait_for_boot_event().await?, FirmwareEvent::BootFailed); | ||
assert_eq!(vm.wait_for_teardown().await?, HaltReason::PowerOff); | ||
Ok(()) | ||
} | ||
|
||
/// Basic boot test for guests that are expected to reboot | ||
// TODO: Remove this test and other enable Windows 11 ARM OpenVMM tests | ||
// once we figure out how to get the guest to not reboot via IMC or other | ||
|
Oops, something went wrong.
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.
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.
Do we have other tests with secure boot that can be removed/folded into this?
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.
good point, ill have to look around for these
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.
as far as I know, looks like we don't have any other tests with secure boot explicitly?
I did notice
guest_test_uefi
multiarch test haswith_windows_secure_boot_template()
.My new
with_secure_boot()
could be used instead? But I'm not sure if, based on the OsFlavor forguest_test_uefi_x64
orguest_test_uefi_aarch64
what the correct secure boot template would be in this case-- must it be the windows template?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.
Should we add a test that verifies Linux fails to boot with the Windows secure boot template?
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.
Yes, we should-- I'll add these negative tests next