x86_64_v2: OVMF ships x86-64-v3 code (noarch, not rebuilt) — no UEFI guest can boot #1
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
AlmaLinux 10's
edk2-ovmfis anoarchpackage, so it is not rebuilt for thex86_64_v2variant — thex86_64_v2repositories serve the same binary as thestandard
x86_64ones. That binary contains BMI1 instructions, so on a CPU thatonly implements
x86-64-v2the firmware triple-faults immediately after SEC and theguest never boots.
The
x86_64_v2variant exists to support pre-v3 CPUs, but its UEFI firmware does notrun on them, which makes UEFI virtualization unusable on such hosts.
ipxe-roms-qemuhas the same problem for the same reason (alsonoarch); detailsat the end. The two compound: fixing only
edk2-ovmfstill leaves every libvirt guesthanging, because libvirt always attaches a NIC and OVMF always loads its option ROM.
The failure is silent — nothing on the guest serial console, nothing in
dmesg, noSELinux AVC. The VNC console just shows
Guest has not initialized the display (yet)while the vCPU spins at 100%.
Affected environment
x86_64_v2variant (repos are?arch=x86_64_v2)edk2-ovmf-20251114-5.el10_2.2.noarchqemu-kvm-18:10.1.0-16.el10_2.2.alma.1.x86_64_v2,libvirt 11.10.0avx,avx2,bmi1,bmi2,abm/lzcnt,fma,f16c.ld.so --helpreportsx86-64-v2 (supported)as thehighest level.
Any
x86-64-v2-only CPU should reproduce (Goldmont / Goldmont Plus / Silvermont basedAtom, Celeron and Pentium Silver; early Nehalem/Westmere-era parts, etc.).
Steps to reproduce — no v2-only hardware required
TCG lets you subtract CPU features, so this reproduces on any machine:
/tmp/ovmf.logfills with nothing but the SEC entry banner, repeated forever:Remove
bmi1=offand the same command reaches the UEFI boot manager normally.bmi1=offalone is sufficient to reproduce;bmi2=offorabm=offalone are not.Evidence
Firmware / accelerator matrix, same host, same disk:
edk2-ovmfel10_2.2-cpu host(J4125)edk2-ovmfel10_2.2-cpu Nehalem/host-modeledk2-ovmfel10_2.2-cpu maxedk2-ovmfel10_2.2-cpu max,bmi1=offedk2-ovmffrom el9 (20241117-8.el9)-cpu host(J4125)seabios-bin)-cpu host(J4125)The
x86_64_v2repository ships the identical file as the standardx86_64repository, confirming that no separate v2 build exists:
Root cause
edk2.specdoes export the distro flags:but
EXTRA_OPTFLAGSis only consumed byBaseTools/Source/C/Makefiles/header.makefile,i.e. the host build tools. The firmware itself is compiled with EDK2's own flag set
(
tools_def.template), which contains no-march. An actual firmware compile linefrom the build log:
So the compiler's built-in default decides the ISA baseline of the shipped binary,
and on a RHEL-10-baseline builder that default is
x86-64-v3.Note that EDK2 does disable SIMD explicitly (
-mno-mmx -mno-sse), because firmwarecannot rely on FPU/SIMD state — but nothing guards against general-purpose ISA
extensions such as BMI1, which the compiler emits freely whenever the default
-marchallows it. That is exactly the gap here.Combined with
BuildArch: noarchon the firmware subpackage, the result is a packagelabelled architecture-independent whose payload is x86_64 machine code built for
whatever the builder's compiler defaulted to.
A plain rebuild fixes it — no spec or source change needed
Rebuilding the unmodified SRPM on an
x86_64_v2AlmaLinux 10 host is sufficient,because that host's GCC defaults to
-march=x86-64-v2:Result — a different binary that boots on the v2-only CPU under KVM:
Suggested fix
edk2on thex86_64_v2builders and ship that binary inthe
x86_64_v2repositories, even though the subpackage isnoarch.-march=x86-64or-march=x86-64-v2) instead of inheriting the builder's compilerdefault. A firmware image shipped as
noarchshould not silently depend on whichmachine built it.
noarchpackage carrying compiled x86_64 payloads is suspect.seabios-bin/seavgabios-binappeared to work in our testing, but the whole classshould be checked.
Same problem in
ipxe-roms-qemuipxe-roms-qemu-20240119-5.gitde8a0821.el10.noarchshipsefi-virtio.rom(the iPXE EFIdriver) with the same defect.
ipxe.specdoes not pass%{optflags}at all — it justruns
make %{?_smp_mflags} NO_WERROR=1 V=1 GITVERSION=...— so iPXE's own flags plus thecompiler default apply, and the subpackage is
noarchtoo.With working firmware but the stock ROM, OVMF faults while loading the option ROM of a
virtio-net device (
1af4:1000):The vCPU then spins at a fixed
RIP(CpuDeadLoop()), which is why the guest looks"hung" rather than "crashed". This is easy to mistake for a libvirt bug: bare
qemu-kvmwithout a NIC boots fine, while every libvirt guest hangs.
A plain
rpmbuild --rebuildof the unmodifiedipxeSRPM on a v2 host fixes it too:romfile=efi-virtio.rom#UDinside1af41000.efidrv, thenCpuDeadLoop()efi-virtio.rom[Bds] Entry...→>>Start PXE over IPv4.— iPXE runs normallyI am happy to file that as a separate issue against
rpms/ipxeif you prefer themtracked separately.
Workarounds for users on v2-only hardware
OVMF_CODE.fd/OVMF_VARS.fdfrom the EL9edk2-ovmfpackage and point thedomain at them, and
<rom enabled='no'/>, i.e.romfile=""),which is harmless unless PXE/HTTP boot is needed.
Hi.
Could you please check if it helps you?
edk2 - https://build.almalinux.org/build/74889
ipxe - https://build.almalinux.org/build/75251
You can add it as repo to your system
Sorry for the late reply — I only noticed your comment today, three days after you posted it.
Thank you for turning both packages around so quickly, and for pinning the baseline in the build flags rather than working around it downstream.
I tried to look at the repositories you pointed me to, but the baseurl seems to return 502 at the moment.
dnfcannot fetch the metadata:The same happens for the 75251 repository. Is this a temporary outage, or should I be fetching the packages from somewhere else?
Once the packages are downloadable I will find some time to try them on the affected machine (a Celeron J4125, x86-64-v2) and report back.
Could you please check it now? We had an issue with our build system
Thank you for getting the repositories back up. Both test repos are reachable again, so I tried the
builds right away on the affected hardware. Both packages are confirmed fixed.
Test setup
Real hardware, no CPU feature masking — an Intel Celeron J4125 (Gemini Lake), which has no BMI1:
The guest is a Home Assistant OS image, i.e. an ordinary UEFI guest. Each combination was tested
from
rpm2cpio-extracted files, so nothing on the installed system was changed while testing.Results
20251114-5.el10_2.220240119-5.gitde8a0821.el10…5.el10_2.2.alma.120240119-5.gitde8a0821.el10#UD, see below…5.el10_2.2.alma.1…el10.alma.1Case C is the interesting one. With the fixed firmware but the current iPXE ROM, EDK2 now gets far
enough to print its exception dump, and it names the faulting image:
So
edk2andipxeare two independent defects, and your two builds fix them independently.Fixing only one of them is not enough — that may be worth knowing if anyone else reports this.
Static check
Disassembling the firmware volume and counting v3-only mnemonics, using the current package as a
control:
OVMF_CODE.fd—5.el10_2.2OVMF_CODE.fd—5.el10_2.2.alma.1Same figures for
OVMF_CODE.secboot.fd. Foripxe-roms-qemuthis method is inconclusive, becausethe EFI ROMs embed a compressed payload and the instructions are not visible from outside. That is
why case C above matters: a boot test is the only way to confirm the iPXE side.
In production
I have installed both
.alma.1packages on the affected host and pointed my VM back at thedistro-provided
/usr/share/edk2/ovmf/OVMF_CODE.fd. My local rebuilds are now removed entirely,and the guest has been running normally since. Thank you for turning this around so quickly.
Thank you for confirming that the fix works for you!
I'll close that issue as fixed.
Packages with the fix will be released to the public repos in a week.
Thank you for the quick turnaround on this, and for closing the loop here.
Nothing further from my side: the affected host has been running the .alma.1 builds since the test, and I will pick the packages up from the public repos once they are released.
Thanks again for fixing both edk2-ovmf and ipxe-roms-qemu.