From 6d08623aca2a8d9c9a699ebce993d9df55ac38f3 Mon Sep 17 00:00:00 2001
From: Daniel Hilst <392820+dhilst@users.noreply.github.com>
Date: Sat, 7 Nov 2026 07:49:53 -0300
Subject: [PATCH 1/2] test(kvm): a UEFI node without Secure Boot takes
whichever firmware the host prefers
A node with vm.othersettings firmware:efi asks for UEFI and states nothing
about Secure Boot. libvirt then picks the firmware descriptor of highest
priority that fits the guest. On an EL 10 host the first x86_64 descriptor is
30-edk2-ovmf-x64-sb-enrolled.json, so that node starts with Secure Boot on and
with keys enrolled, and the firmware refuses its unsigned kernel. The same node
boots on another host, because descriptor priority is host policy.
The checks say firmware_features returns the secure-boot feature disabled for a
node that asks for UEFI alone, and no feature at all for a BIOS node, where
libvirt reads no feature.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
---
xCAT-test/unit/kvm_secureboot_firmware.t | 61 +++++++++++++++---------
1 file changed, 39 insertions(+), 22 deletions(-)
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( "", [] ),
"",
From 04a1d6865a613058e5e9d3b59fbafd634dc9ad46 Mon Sep 17 00:00:00 2001
From: Daniel Hilst <392820+dhilst@users.noreply.github.com>
Date: Sat, 7 Nov 2026 07:50:34 -0300
Subject: [PATCH 2/2] fix(kvm): a UEFI node without Secure Boot starts on a
firmware that verifies what it boots
firmware_features returned no feature for a node whose vm.othersettings says
firmware:efi, so the domain stated nothing about Secure Boot. libvirt then runs
firmware autoselection and takes the descriptor of highest priority that fits
the guest. The descriptors are ordered by file name, and the first x86_64 one of
an EL 10 host is 30-edk2-ovmf-x64-sb-enrolled.json, so the node starts with
Secure Boot on and with keys enrolled. The firmware then refuses the unsigned
kernel the node netboots. The same node boots on a host whose first descriptor
is 50-edk2-ovmf-x64-nosb.json, because the order is host policy.
firmware_features now returns the secure-boot feature disabled for a UEFI guest
that does not ask for Secure Boot, which is the requirement libvirt filters the
descriptors by. It says nothing about enrolled-keys, which only a firmware with
secure-boot reads. A guest with no firmware still asks for no feature, because
libvirt refuses a feature where no firmware autoselection runs.
kvm_secureboot_firmware.t covers both, and its four new checks fail without
this change.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
---
docs/source/advanced/ipxe/index.rst | 2 +-
perl-xCAT/xCAT/KVMUtils.pm | 17 ++++++++++++++---
2 files changed, 15 insertions(+), 4 deletions(-)
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' },