diff --git a/0351-arm64-Use-proper-memory-type-for-kernel-allocation.patch b/0351-arm64-Use-proper-memory-type-for-kernel-allocation.patch new file mode 100644 index 00000000..e77fcbf6 --- /dev/null +++ b/0351-arm64-Use-proper-memory-type-for-kernel-allocation.patch @@ -0,0 +1,44 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Maximilian Luz +Date: Tue, 28 Jun 2022 23:06:46 +0200 +Subject: [PATCH] arm64: Use proper memory type for kernel allocation + +Currently, the kernel pages are allocated with type EFI_LOADER_DATA. +While the vast majority of systems will happily execute code from those +pages (i.e. don't care about memory protection), the Microsoft Surface +Pro X stalls, as this memory is not designated as "executable". + +Therefore, allocate the kernel pages as EFI_LOADER_CODE to request +memory that is actually executable. + +Signed-off-by: Maximilian Luz +--- + grub-core/loader/arm64/linux.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c +index 419f2201df8b..a3a193c255e9 100644 +--- a/grub-core/loader/arm64/linux.c ++++ b/grub-core/loader/arm64/linux.c +@@ -26,7 +26,9 @@ + #include + #include + #include ++#include + #include ++#include + #include + #include + #include +@@ -403,7 +405,10 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + grub_loader_unset(); + + kernel_alloc_pages = GRUB_EFI_BYTES_TO_PAGES (kernel_size + align - 1); +- kernel_alloc_addr = grub_efi_allocate_any_pages (kernel_alloc_pages); ++ kernel_alloc_addr = grub_efi_allocate_pages_real (GRUB_EFI_MAX_USABLE_ADDRESS, ++ kernel_alloc_pages, ++ GRUB_EFI_ALLOCATE_MAX_ADDRESS, ++ GRUB_EFI_LOADER_CODE); + grub_dprintf ("linux", "kernel numpages: %d\n", kernel_alloc_pages); + if (!kernel_alloc_addr) + { diff --git a/grub.patches b/grub.patches index 8582cea9..e79df3f7 100644 --- a/grub.patches +++ b/grub.patches @@ -348,3 +348,4 @@ Patch0347: 0347-grub2-mkconfig-Ensure-grub-cfg-stub-is-not-overwritt.patch Patch0348: 0348-chainloader-remove-device-path-debug-message.patch Patch0349: 0349-grub2-mkconfig-Simplify-os_name-detection.patch Patch0350: 0350-grub-mkconfig-Remove-check-for-mount-point-for-grub-.patch +Patch0351: 0351-arm64-Use-proper-memory-type-for-kernel-allocation.patch diff --git a/grub2.spec b/grub2.spec index 197dd763..db23775a 100644 --- a/grub2.spec +++ b/grub2.spec @@ -16,7 +16,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 91%{?dist} +Release: 92%{?dist} Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -547,6 +547,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Tue Aug 13 2024 Nicolas Frayer - 2.06-92 +- arm64/linux: Allocate memory for kernel with EFI_LOADER_CODE type +- Resolves: #RHEL-49868 + * Fri Aug 2 2024 Leo Sandoval - 2.06-91 - Set /boot/grub2/grub.cfg to 0600 mode if present - Resolves: #RHEL-45870