diff --git a/docs/source/advanced/ipxe/index.rst b/docs/source/advanced/ipxe/index.rst
index 6fb85c9666..4fe963c287 100644
--- a/docs/source/advanced/ipxe/index.rst
+++ b/docs/source/advanced/ipxe/index.rst
@@ -92,7 +92,7 @@ Both features are asked for, because the two are separate. ``secure-boot`` names
A hypervisor that ships no such firmware refuses the domain with ``Unable to find 'efi' firmware that is compatible with the current configuration``, rather than starting the node on a firmware that verifies nothing.
-``firmware:efi`` keeps its meaning and asks for no feature, so a node that asks only for UEFI takes the firmware its hypervisor prefers.
+``firmware:efi`` asks for UEFI with Secure Boot off. Without that, libvirt picks the descriptor of highest priority that fits the node, and the first x86_64 descriptor of an EL 10 host is ``30-edk2-ovmf-x64-sb-enrolled.json``, so a node that asked only for UEFI starts with Secure Boot on and refuses its own unsigned kernel.
Known limits of the upstream loader
-----------------------------------
diff --git a/perl-xCAT/xCAT/KVMUtils.pm b/perl-xCAT/xCAT/KVMUtils.pm
index d459b1453f..356c857b59 100644
--- a/perl-xCAT/xCAT/KVMUtils.pm
+++ b/perl-xCAT/xCAT/KVMUtils.pm
@@ -67,8 +67,9 @@ sub default_storagemodel {
move to scsi.
efi-secureboot also sets secureboot, which guest_os turns into the requirement
- libvirt reads. efi alone states no requirement, so libvirt takes the descriptor of
- highest priority that fits the guest, and that order belongs to the hypervisor.
+ libvirt reads. efi alone asks for no Secure Boot, which firmware_features states as a
+ feature: libvirt otherwise takes the descriptor of highest priority that fits the
+ guest, and that order belongs to the hypervisor.
Arguments:
$guest_arch - nodetype.arch of the node, or undef
$hyp_cpumodel - the cpumodel of the hypervisor, or undef
@@ -588,6 +589,15 @@ sub guest_os {
libvirt reads as the secure-boot feature alone, and picks the
descriptor of highest priority that carries it. A host that ships the 40- descriptor
and not the 30- one satisfies that domain with an empty key store.
+
+ A guest that asks for UEFI and no secureboot states secure-boot off. Without that
+ feature libvirt takes the descriptor of highest priority again, and the 30- one is
+ first on an EL 10 host, so the guest starts with Secure Boot on and refuses its own
+ unsigned kernel. It states nothing about enrolled-keys, which only a firmware with
+ secure-boot reads.
+
+ A guest with no firmware runs no firmware autoselection, and libvirt refuses a
+ feature there, so it asks for none.
Arguments:
$profile - the hash reference from guest_arch_profile, or undef
Returns:
@@ -598,7 +608,8 @@ sub guest_os {
#-------------------------------------------------------
sub firmware_features {
my ($profile) = @_;
- return [] unless ref($profile) eq 'HASH' and $profile->{secureboot};
+ return [] unless ref($profile) eq 'HASH' and defined $profile->{firmware};
+ return [ { name => 'secure-boot', enabled => 'no' } ] unless $profile->{secureboot};
return [
{ name => 'secure-boot', enabled => 'yes' },
{ name => 'enrolled-keys', enabled => 'yes' },
diff --git a/xCAT-test/unit/kvm_secureboot_firmware.t b/xCAT-test/unit/kvm_secureboot_firmware.t
index 51e97d2140..e8299d06c0 100644
--- a/xCAT-test/unit/kvm_secureboot_firmware.t
+++ b/xCAT-test/unit/kvm_secureboot_firmware.t
@@ -2,11 +2,12 @@
# An x86_64 KVM guest asks libvirt for UEFI with Secure Boot on with vm.othersettings
# "firmware:efi-secureboot".
#
-# firmware:efi alone states no requirement about Secure Boot. libvirt then takes the firmware
-# descriptor of highest priority that fits the guest, and that order is host policy: the same
-# node boots with Secure Boot on on one hypervisor and off on another, and the domain reports
-# neither. A node that must boot signed binaries has to say so, so that a hypervisor without a
-# Secure Boot firmware refuses the domain instead of starting it unverified.
+# A node states what it wants, in both directions. firmware:efi alone states no requirement,
+# and libvirt then takes the firmware descriptor of highest priority that fits the guest. That
+# order is host policy: on an EL 10 host the first x86_64 descriptor is
+# 30-edk2-ovmf-x64-sb-enrolled.json, so a node that asked only for UEFI boots with Secure Boot
+# on and keys enrolled, and its unsigned kernel is refused. So firmware:efi asks for
+# secure-boot off, and firmware:efi-secureboot asks for it on.
#
# is not that requirement on its own. libvirt reads it as the secure-boot
# feature, and a firmware with secure-boot and an empty key store boots an unsigned binary. The
@@ -65,13 +66,14 @@ is( $sb->{disk_model}, 'scsi', 'and its disks take the scsi bus, because q35 has
is( $sb_os->{bios}->{useserial}, 'yes',
'and it keeps , so its boot still reaches the serial console' );
-# firmware:efi must keep stating nothing about Secure Boot. A site that asked only for UEFI
-# gets the firmware its hypervisor prefers, as it did before.
+# firmware:efi asks for UEFI and for no Secure Boot. is the requirement
+# for Secure Boot on, so it stays off the of that node; the requirement for Secure Boot off
+# is a feature, which guest_os cannot carry.
my $uefi_os = os_of( node_profile('firmware:efi') );
is( $uefi_os->{firmware}, 'efi', 'firmware:efi still asks for UEFI' );
-is( $uefi_os->{loader}, undef, 'and states no Secure Boot requirement' );
+is( $uefi_os->{loader}, undef, 'and does not ask for a firmware that verifies what it boots' );
is( os_of( node_profile(undef) )->{loader},
- undef, 'a node that asks for no firmware states no Secure Boot requirement either' );
+ undef, 'a node that asks for no firmware does not ask for one either' );
# A value libvirt cannot select is refused by name, and the refusal names both values a node
# may ask for. A typo must not leave the node on a firmware it did not ask for.
@@ -135,11 +137,19 @@ is_deeply(
[ { name => 'secure-boot', enabled => 'yes' }, { name => 'enrolled-keys', enabled => 'yes' } ],
'a Secure Boot node asks for secure-boot and for enrolled-keys'
);
-is_deeply( xCAT::KVMUtils::firmware_features( node_profile('firmware:efi') ),
- [], 'firmware:efi asks for no firmware feature' );
+is_deeply(
+ xCAT::KVMUtils::firmware_features( node_profile('firmware:efi') ),
+ [ { name => 'secure-boot', enabled => 'no' } ],
+ 'firmware:efi asks for a firmware that verifies nothing, and says nothing about the keys'
+);
+is_deeply( xCAT::KVMUtils::firmware_features( { firmware => 'efi', secureboot => 0 } ),
+ [ { name => 'secure-boot', enabled => 'no' } ],
+ 'an aarch64 or riscv64 profile, which always asks for UEFI, states Secure Boot off as well' );
is_deeply( xCAT::KVMUtils::firmware_features( node_profile(undef) ),
- [], 'and neither does a node that asks for no firmware' );
-is_deeply( xCAT::KVMUtils::firmware_features(undef), [], 'and neither does an undefined profile' );
+ [], 'a node that asks for no firmware asks for no feature, because libvirt reads a feature only with firmware autoselection' );
+is_deeply( xCAT::KVMUtils::firmware_features( { firmware => undef, secureboot => 1 } ),
+ [], 'and so does a profile that asks for Secure Boot without UEFI, which libvirt cannot select' );
+is_deeply( xCAT::KVMUtils::firmware_features(undef), [], 'an undefined profile asks for none' );
# The domain as kvm.pm writes it: the of guest_os, then the features.
sub domain_of {
@@ -170,15 +180,22 @@ is( XML::LibXML->load_xml( string => $sb_domain )->findnodes('/domain/os/loader'
->getAttribute('secure'),
'yes', 'and keeps beside the features' );
-# A node that asked only for UEFI gets no , so it keeps taking the descriptor its
-# hypervisor prefers.
-foreach my $othersettings ( 'firmware:efi', undef ) {
- my $name = defined($othersettings) ? $othersettings : 'no firmware';
- my $domain = domain_of( node_profile($othersettings) );
- is_deeply(
- [ XML::LibXML->load_xml( string => $domain )->findnodes('/domain/os/firmware') ],
- [], "$name states no firmware feature" );
-}
+# A node that asked only for UEFI states Secure Boot off, so the firmware it gets does not
+# depend on the order the hypervisor keeps its descriptors in.
+my $uefi_domain = domain_of( node_profile('firmware:efi') );
+is( feature_enabled( $uefi_domain, 'secure-boot' ),
+ 'no', 'the domain of a UEFI node asks for a firmware that verifies nothing' );
+is( feature_enabled( $uefi_domain, 'enrolled-keys' ),
+ undef, 'and states nothing about the keys, which only a Secure Boot firmware reads' );
+is( XML::LibXML->load_xml( string => $uefi_domain )->findnodes('/domain/os/loader')->[0],
+ undef, 'and keeps off the domain' );
+
+# A BIOS node takes no element. libvirt reads a feature only where firmware
+# autoselection runs, and refuses a domain that states one with no firmware attribute on .
+is_deeply(
+ [ XML::LibXML->load_xml( string => domain_of( node_profile(undef) ) )
+ ->findnodes('/domain/os/firmware') ],
+ [], 'a node that asks for no firmware states no firmware feature' );
is( xCAT::KVMUtils::add_firmware_features( "", [] ),
"",