efi: add protocol: efi_handover for firmware-native chainloading#578
efi: add protocol: efi_handover for firmware-native chainloading#578alexvoste wants to merge 1 commit into
Conversation
Add optional EFI handover protocol that uses firmware-native LoadImage() with a DevicePath instead of loading EFI images via an intermediate RAM buffer. This makes image execution closer to native UEFI boot behavior and avoids bootloader-mediated image loading paths. May improve compatibility in dual-boot setups involving Windows Boot Manager and TPM-based measurements (e.g. BitLocker), where differences in the measured boot chain can trigger recovery prompts. This is implemented as a separate optional protocol and does not change existing chainload behavior.
|
Hey, thanks for the PR! First off let me mention issue #576 so the author can get notified about this PR. Second, I would frankly prefer to avoid adding yet another completely sepearate If anything, I'd change the If needed it could also be made into a flag/modifier option inside the In any case @valiukasd should confirm that it actually does achieve what we intend it to, before moving on. |
|
Hey! Thanks for the quick feedback, Mintsuki. I completely agree with keeping the protocol list clean and avoiding config bloating. Integrating this behavior directly into the existing Personally, I think Option 2 (adding a flag/modifier option inside the existing If we go with a flag, what name would you prefer? Something like I'll refactor the code as soon as we agree on the design. Let's also wait for @valiukasd to confirm the BitLocker/TPM bypass on their machine! |
|
Hey, I will test the feature as soon as I figure out how to build and use the local version of the bootloader. As for the flag or protocol, from a user standpoint, a flag seems more logical since the protocol is still the same. Will report here after I confirm if the changes solve the issue |
Description
This PR implements the new
protocol: efi_handoveroption proposed in the active BitLocker/TPM issue.Why this is needed:
Currently, the standard
protocol: efireads the target binary into a memory buffer before passing it togBS->LoadImage(). This execution from an anonymous RAM buffer alters the TPM PCR 4 measurement because Limine leaves its active footprint in the boot chain. As a result, Windows BitLocker detects a "tampered" boot path and forces the user into the recovery key screen on every dual-boot start.What this PR does:
Instead of allocating memory and parsing the image manually,
efi_handoveruses native UEFI firmware services:EFI_DEVICE_PATH(efi_file_path) and partition handle of the target image.EFI_DEVICE_PATHdirectly togBS->LoadImage(FALSE, ...), allowing the motherboard's native filesystem drivers to handle the load and signature checks natively.gBS->StartImage().This keeps the TPM measurements clean, allowing seamless dual-booting with Windows BitLocker active, without requiring double-POST reboots via
efi_boot_entry.Testing status:
clang -target x86_64-unknown-none-elf.