git: DragonFly_RELEASE_6_4 loader: Clear CR0.WP during EFI kernel relocation

Aaron LI aly at crater.dragonflybsd.org
Thu Oct 1 18:44:59 PDT 2026


commit a8c6b039f4cd1d25033e49caa7dbe17e5c34b18a
Author: David Bidner <david at crap.solutions>
Date:   Thu Oct 1 05:04:52 2026 +0200

    loader: Clear CR0.WP during EFI kernel relocation
    
    Firmware on an HP ProDesk 600 G4 leaves relocation destination pages
    read-only. efi_copy_finish() faults at 0x1001000 with page-fault error
    code 3 (supervisor write, protection violation) while CR0.WP is set.
    
    Save CR0 and clear WP around the relocation copy after ExitBootServices,
    with interrupts disabled. Restore CR0 before entering the kernel. Reject
    active CET before leaving boot services, since it prevents clearing WP.
    
    Bug: https://bugs.dragonflybsd.org/issues/3427

Summary of changes:
 stand/boot/efi/loader/arch/x86_64/amd64_tramp.S   | 11 +++++++++++
 stand/boot/efi/loader/arch/x86_64/elf64_freebsd.c |  8 ++++++++
 2 files changed, 19 insertions(+)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/a8c6b039f4cd1d25033e49caa7dbe17e5c34b18a


-- 
DragonFly BSD source repository


More information about the Commits mailing list