git: 9b0b515befac - stable/13 - loader.efi: make sure kernel image is executable
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 23 Jan 2023 12:37:49 UTC
The branch stable/13 has been updated by andrew:
URL: https://cgit.FreeBSD.org/src/commit/?id=9b0b515befac603b3584a10098fdc9956191f5a8
commit 9b0b515befac603b3584a10098fdc9956191f5a8
Author: Robert Clausecker <fuz@fuz.su>
AuthorDate: 2023-01-02 21:12:50 +0000
Commit: Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2023-01-23 12:36:28 +0000
loader.efi: make sure kernel image is executable
The Windows Dev Kit 2023 (Volterra) has an UEFI implementation that maps
EfiLoaderData pages as non-executable. Map the kernel as EfiLoaderCode
to ensure that it can be executed.
With this change and another in review, FreeBSD boots to the mountroot
prompt if hw.pac.enable = 0 is set in loader.conf(5).
Reviewed by: andrew, imp, tsoome
Sponsored by: Berliner Linux User Group e.V.
Sponsored by: spline / FU-Berlin
Differential Revision: https://reviews.freebsd.org/D37931
(cherry picked from commit 95fa2e0aee5b7259cf4bcdea7396c4dff3241173)
---
stand/efi/loader/copy.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/stand/efi/loader/copy.c b/stand/efi/loader/copy.c
index 19521a854402..abf908b09548 100644
--- a/stand/efi/loader/copy.c
+++ b/stand/efi/loader/copy.c
@@ -331,7 +331,7 @@ efi_copy_init(void)
staging = get_staging_max();
#endif
- status = BS->AllocatePages(EFI_ALLOC_METHOD, EfiLoaderData,
+ status = BS->AllocatePages(EFI_ALLOC_METHOD, EfiLoaderCode,
nr_pages, &staging);
if (EFI_ERROR(status)) {
printf("failed to allocate staging area: %lu\n",
@@ -399,7 +399,7 @@ efi_check_space(vm_offset_t end)
/* Try to allocate more space after the previous allocation */
addr = staging_end;
- status = BS->AllocatePages(AllocateAddress, EfiLoaderData, nr_pages,
+ status = BS->AllocatePages(AllocateAddress, EfiLoaderCode, nr_pages,
&addr);
if (!EFI_ERROR(status)) {
staging_end = staging_end + nr_pages * EFI_PAGE_SIZE;
@@ -416,7 +416,7 @@ before_staging:
addr = rounddown2(addr, M(2));
#endif
nr_pages = EFI_SIZE_TO_PAGES(staging_base - addr);
- status = BS->AllocatePages(AllocateAddress, EfiLoaderData, nr_pages,
+ status = BS->AllocatePages(AllocateAddress, EfiLoaderCode, nr_pages,
&addr);
if (!EFI_ERROR(status)) {
/*
@@ -439,7 +439,7 @@ expand:
#if defined(__i386__) || defined(__amd64__)
new_base = get_staging_max();
#endif
- status = BS->AllocatePages(EFI_ALLOC_METHOD, EfiLoaderData,
+ status = BS->AllocatePages(EFI_ALLOC_METHOD, EfiLoaderCode,
nr_pages, &new_base);
if (!EFI_ERROR(status)) {
#if EFI_STAGING_2M_ALIGN