arm64/linux: Allocate memory for kernel with EFI_LOADER_CODE type
Resolves: #RHEL-49868 Signed-off-by: Nicolas Frayer <nfrayer@redhat.com>
This commit is contained in:
parent
d5d341df5d
commit
ec05bd1b7c
@ -0,0 +1,44 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Maximilian Luz <luzmaximilian@gmail.com>
|
||||
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 <luzmaximilian@gmail.com>
|
||||
---
|
||||
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 <grub/mm.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/cpu/linux.h>
|
||||
+#include <grub/efi/api.h>
|
||||
#include <grub/efi/efi.h>
|
||||
+#include <grub/cpu/efi/memory.h>
|
||||
#include <grub/efi/fdtload.h>
|
||||
#include <grub/efi/memory.h>
|
||||
#include <grub/efi/linux.h>
|
||||
@@ -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)
|
||||
{
|
@ -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
|
||||
|
@ -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 <nfrayer@redhat.com> - 2.06-92
|
||||
- arm64/linux: Allocate memory for kernel with EFI_LOADER_CODE type
|
||||
- Resolves: #RHEL-49868
|
||||
|
||||
* Fri Aug 2 2024 Leo Sandoval <lsandova@redhat.com> - 2.06-91
|
||||
- Set /boot/grub2/grub.cfg to 0600 mode if present
|
||||
- Resolves: #RHEL-45870
|
||||
|
Loading…
Reference in New Issue
Block a user