git: 6db7fa3765ae - stable/15 - loader: Allocate trampoline as EfiLoaderCode, not Data

Ed Maste <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.src
Message-ID <6a75093d.1e772.57742b7c__24266.6010440857$1786054988$gmane$org@gitrepo.freebsd.org>
The branch stable/15 has been updated by emaste:

URL: https://cgit.FreeBSD.org/src/commit/?id=6db7fa3765aea89329830c892547695e477d3bfc

commit 6db7fa3765aea89329830c892547695e477d3bfc
Author:     Ed Maste <[email protected]>
AuthorDate: 2026-07-21 19:19:40 +0000
Commit:     Ed Maste <[email protected]>
CommitDate: 2026-08-06 22:19:06 +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 <[email protected]>
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D58383
    
    (cherry picked from commit 2b1df6149e8a2d50a09d13c64d1574dad91e10b1)
---
 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 fa7bc82c2fb2..592d553094ab 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");
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.