Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Jul 2026 21:23:41 +0000
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 2b1df6149e8a - main - loader: Allocate trampoline as EfiLoaderCode, not Data
Message-ID:  <6a5fe35d.31069.4a3325c1@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=2b1df6149e8a2d50a09d13c64d1574dad91e10b1

commit 2b1df6149e8a2d50a09d13c64d1574dad91e10b1
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2026-07-21 19:19:40 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2026-07-21 21:23:11 +0000

    loader: Allocate trampoline as EfiLoaderCode, not Data
    
    Firmware on a test machine applied NX to non-code allocations, which
    resulted in a fault when jumping to the trampoline.
    
    Reviewed by:    kib
    Tested by:      Jim Huang Chen <jim.chen.1827@gmail.com>
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D58383
---
 stand/efi/loader/arch/amd64/elf64_freebsd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/stand/efi/loader/arch/amd64/elf64_freebsd.c b/stand/efi/loader/arch/amd64/elf64_freebsd.c
index 62716d7b1369..2ba5c1419168 100644
--- a/stand/efi/loader/arch/amd64/elf64_freebsd.c
+++ b/stand/efi/loader/arch/amd64/elf64_freebsd.c
@@ -102,7 +102,7 @@ elf64_exec(struct preloaded_file *fp)
 
 	trampcode = copy_staging == COPY_STAGING_ENABLE ?
 	    (vm_offset_t)G(1) : (vm_offset_t)G(4);
-	err = BS->AllocatePages(AllocateMaxAddress, EfiLoaderData, 1,
+	err = BS->AllocatePages(AllocateMaxAddress, EfiLoaderCode, 1,
 	    (EFI_PHYSICAL_ADDRESS *)&trampcode);
 	if (EFI_ERROR(err)) {
 		printf("Unable to allocate trampoline\n");


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a5fe35d.31069.4a3325c1>