Repository navigation
Open
Description
Symptom
- UEFI shell hangs when running
dhafter booting iPXE under Secure Boot. - Reproducible regardless of whether the downloaded boot image(download during iPXE flow) is signed or unsigned.
- Reproducibility rate: 100%.
iPXE version
Firmware Environment
- UEFI x86_64
- EDK2-based BIOS firmware
- Secure Boot enabled
Steps to Reproduce
- Boot an x86_64 system from an iPXE USB image under UEFI Secure Boot.
- Let iPXE download and attempt to boot a network image.
- Return to the firmware/BIOS environment (for example, by using a returnable image path or another method that makes iPXE hand control back to the firmware).
- Launch the UEFI shell from there.
- Run the
dhcommand. - The system hangs.
Root Cause
- The iPXE shim uses the shim loader path from rhboot/shim, which hooks
LoadImage(),StartImage(), andUnloadImage()in the EFI Boot Services table when Secure Boot is enabled. - In
loader-proto.c,shim_load_image()installsLoadedImage,LoadedImageDevicePath, andSHIM_LOADED_IMAGE_GUIDon a newly created image handle viaInstallMultipleProtocolInterfaces(ImageHandle, ...). - On the error cleanup path, the code calls
UninstallMultipleProtocolInterfaces(ImageHandle, ...)instead ofUninstallMultipleProtocolInterfaces(*ImageHandle, ...). - As a result, the installed protocols are not properly uninstalled, and the image handle is leaked.
Also Found
- The iPXE boot flow uses the following image lifecycle sequence:
efi_image_probe()->LoadImage()->UnloadImage()->efi_image_exec()->LoadImage()->StartImage(). See ipxe/src/image/efi_image.c for details - When Secure Boot is enabled, the shim loader hooks these EFI Boot Services calls, which is where the issue is exposed.
- The first
UnloadImage()happens beforeStartImage(), so if cleanup is only expected inshim_start_image(), the first image handle will be leaked.
Additional Debug Observations
Debug logs captured during LoadImage() show the protocol install/uninstall flow in both successful (boot image signed) and failed (boot image not signed) cases. You can find that image handle seems to be leaked in both cases.
Suggested Solution
- Fix the error cleanup in
shim_load_image()to uninstall using*ImageHandle. - Remove the protocol uninstall / image free logic from
shim_start_image(). - Move the cleanup work into
shim_unload_image().
Notes
- The proposed fix has not yet been verified in the current test environment and should be treated as a suggested remediation, not as a confirmed resolution.
- This issue is not specific to PXE vs HTTP, nor to a particular hardware platform such as CRB.
- This appears to be a shim-side issue in the loader path used by the iPXE shim, not an iPXE core bug in the main iPXE code path. See System hang(CPU exception) occurs in UEFI shell after iPXE returns control when secure boot enabled. ipxe/ipxe#1730 for more information.
Metadata
Metadata
Assignees
Labels
No labels



Activity