aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2026-07-21 19:19:40 +0000
committerEd Maste <emaste@FreeBSD.org>2026-08-06 22:19:06 +0000
commit6db7fa3765aea89329830c892547695e477d3bfc (patch)
treeff3d9a1c6499fe7e4cc32a25c94f04fbaf30d3a1
parent6154eec89acb3aa6561f2e8ba365115a8056591d (diff)
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 (cherry picked from commit 2b1df6149e8a2d50a09d13c64d1574dad91e10b1)
-rw-r--r--stand/efi/loader/arch/amd64/elf64_freebsd.c2
1 files changed, 1 insertions, 1 deletions
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");