unbalanced UEFI TPL manipulations in iPXE with DOWNLOAD_PROTO_HTTPS enabled
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
iPXE |
Fix Committed
|
Undecided
|
Unassigned | ||
ipxe (Ubuntu) |
Fix Released
|
Medium
|
Unassigned | ||
Focal |
Fix Released
|
Medium
|
Unassigned |
Bug Description
[Impact]
* Booting some OVMF through the efi roms in our ipxe-qemu package triggers
a bad ordering of TPL manipulations and eventually gets the boot stuck.
* It was analyzed by Lazlo that this was due to HTTPS being enabled in the
rom itself triggering this fail when gathering entropy. In addition
isn't required to have HTTPS enabled in this part of the roms as the EFI
payload would be able to handle that on it's own (inside OVMF file from
src:edk2 instead of the combined rom like efi-e1000.rom).
* Disabling HTTPS in the efi-*.rom files should have no functional
impact but mitigate the TPL issues we are seeing.
[Test Case]
* I have provided a test OVMF load attached to this bug
https:/
* Start that in qemu like:
$ qemu-system-x86_64 -enable-kvm -monitor stdio -drive if=pflash,
# /usr/lib/
# /root/edk2/
attached
Symptoms when failing:
- UI never leaves the "initializing" state
- in the debug.log the bad case asserts with
ASSERT /root/edk2/
Image->Tpl == gEfiCurrentTpl
* Extra Test: HTTPS boot a uEFI guest with the efi roms from ipxe-qemu
with old/new ipxe-qmeu code. This shall ensure that OVMF can really take
over as-is or if we need bug 1883114 before we can do so.
Details TBD when I'm doing these tests
* We pad the rom sizes to be sure, but never the less double check
migrations between Bionic <-> Focal (known to break on size changes)
[Regression Potential]
* Messing around with rom options always is a complex topic, but I'd like
to quote Lazlo (who understands all of this better anyway):
"you don't need the iPXE HTTPS implementation, because OVMF already contains the edk2 HTTPS BOOT feature (assuming you build OVMF with "-D NETWORK_
* Never the less, if you seek regressions then in the UEFI handling of
HTTPS boot.
[Other Info]
* This happens with some OVMF versions like the one I have provided for
debugging but not with the OVMF delivered as part of Focal. Therefore we
should fix it but priority isn't that high.
* Quote from the discussion: "If you want to run a full-featured iPXE
build on a UEFI machine (including: in an OVMF guest), you still can,
of course; lots of people do that, for good reasons. But that use case
is best served by the *standalone UEFI application* build of iPXE
(produced at "bin-x86_
build of iPXE should be as minimal as possible, in comparison -- just
provide SNP for the desired NIC models."
=> Only the EFI roms are changed, neither the PCI roms nor the standalon
IPXE builds will be modified.
* It makes sense to keep this longer in -proposed to increase the
chance of more people testing this. Therefore I'd ask to accept this
early. I can do my (extended) tests against -proposed and we'd get
some community coverage.
---
The version of QEMU (4.2.0) packaged for Ubuntu 20.04 hangs indefinitely at boot if an OVMF bios is used. This happens ONLY with qemu-system-x86_64. qemu-system-i386 works fine with the latest ia32 OVMF bios.
NOTE[1]: the same identical OVMF bios works fine on QEMU 2.x packaged with Ubuntu 18.04.
NOTE[2]: reproducing the fatal bug requires *no* operating system:
qemu-
On its window QEMU gets stuck at the very first stage:
"Guest has not initialized the display (yet)."
NOTE[3]: QEMU gets stuck no matter if KVM is used or not.
NOTE[4]: By adding the `-d int` option it is possible to observe that QEMU is, apparently, stuck in an endless loop of interrupts. For the first few seconds, registers' values vary quickly, but at some point they reach a final value, while the interrupt counter increments:
2568: v=68 e=0000 i=0 cpl=0 IP=0038:
RAX=00000000000
RSI=0000000006d
R8 =0000000000000001 R9 =0000000000000089 R10=00000000000
R12=00000000000
RIP=0000000007f
ES =0030 0000000000000000 ffffffff 00cf9300 DPL=0 DS [-WA]
CS =0038 0000000000000000 ffffffff 00af9a00 DPL=0 CS64 [-R-]
SS =0030 0000000000000000 ffffffff 00cf9300 DPL=0 DS [-WA]
DS =0030 0000000000000000 ffffffff 00cf9300 DPL=0 DS [-WA]
FS =0030 0000000000000000 ffffffff 00cf9300 DPL=0 DS [-WA]
GS =0030 0000000000000000 ffffffff 00cf9300 DPL=0 DS [-WA]
LDT=0000 0000000000000000 0000ffff 00008200 DPL=0 LDT
TR =0000 0000000000000000 0000ffff 00008b00 DPL=0 TSS64-busy
GDT= 00000000079eea98 00000047
IDT= 000000000758f018 00000fff
CR0=80010033 CR2=00000000000
DR0=00000000000
DR6=00000000fff
CCS=00000000000
EFER=0000000000
NOTE[5]: Just to better help the investigation of the bug, I'd like to remark that the issue is NOT caused by an endless loop of triple-faults. I tried with -d cpu_reset and there is NO such loop. No triple fault whatsoever.
NOTE[6]: The OVMF version used for the test has been downloaded from:
https:/
but the issue is the same with older OVMF versions as well.
Please take a look at it, as the bug is NOT a corner case. QEMU 4.2.0 cannot boot with an UEFI firmware (OVMF) while virtualizing a x86_64 machine AT ALL.
Thank you very much,
Vladislav K. Valtchev
Related branches
- Rafael David Tinoco (community): Approve
- Canonical Server packageset reviewers: Pending requested
- Canonical Server: Pending requested
-
Diff: 198 lines (+104/-26)6 files modifieddebian/changelog (+11/-1)
debian/patches/enable-https.patch (+19/-0)
debian/patches/lp-1882671-efi-Raise-TPL-during-driver-entry-point.patch (+65/-0)
debian/patches/series (+2/-0)
debian/rules (+3/-17)
debian/util/check-rom-sizes (+4/-8)
- Rafael David Tinoco (community): Approve
- Canonical Server: Pending requested
- Canonical Server packageset reviewers: Pending requested
- git-ubuntu developers: Pending requested
-
Diff: 95 lines (+73/-0)3 files modifieddebian/changelog (+7/-0)
debian/patches/lp-1882671-efi-Raise-TPL-during-driver-entry-point.patch (+65/-0)
debian/patches/series (+1/-0)
- Andreas Hasenack (community): Approve
- Canonical Server: Pending requested
- git-ubuntu developers: Pending requested
-
Diff: 121 lines (+35/-27)5 files modifieddebian/changelog (+10/-0)
debian/patches/series (+0/-1)
debian/rules (+17/-3)
debian/util/check-rom-sizes (+8/-4)
dev/null (+0/-19)
- Andreas Hasenack (community): Approve
- Canonical Server packageset reviewers: Pending requested
- git-ubuntu developers: Pending requested
-
Diff: 121 lines (+35/-27)5 files modifieddebian/changelog (+10/-0)
debian/patches/series (+0/-1)
debian/rules (+17/-3)
debian/util/check-rom-sizes (+8/-4)
dev/null (+0/-19)
- Andreas Hasenack (community): Approve
- Canonical Server: Pending requested
- git-ubuntu developers: Pending requested
-
Diff: 1711 lines (+1299/-148)13 files modifieddebian/changelog (+443/-0)
debian/control (+15/-2)
debian/copyright (+560/-136)
debian/grub-ipxe.install (+3/-0)
debian/grub-ipxe.postinst (+1/-1)
debian/grub-ipxe.postrm (+3/-3)
debian/ipxe.install (+0/-3)
debian/patches/0005-strip-802.1Q-VLAN-0-priority-tags.patch (+121/-0)
debian/patches/handle-dhcp-nack.patch (+43/-0)
debian/patches/series (+2/-0)
debian/rules (+27/-1)
debian/tree/ipxe/etc/grub.d/20_ipxe (+15/-2)
debian/util/check-rom-sizes (+66/-0)
summary: |
- qemu-system-x86_64 (ver 4.2) stuck at boot with OVMF bios + unbalanced UEFI TPL manipulations in iPXE with DOWNLOAD_PROTO_HTTPS + enabled |
description: | updated |
description: | updated |
description: | updated |
tags: |
added: verification-failed verification-failed-focal removed: block-proposed block-proposed-focal verification-needed verification-needed-focal |
Please add
-debugcon file:debug.log -global isa-debugcon. iobase= 0x402
to the QEMU cmdline, and attach "debug.log". Thanks.