nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0558-efi-use-EFI_LOADER_-CODE-DATA-for-kernel-and-initrd-.patch

b54ed4
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
b54ed4
From: Peter Jones <pjones@redhat.com>
b54ed4
Date: Mon, 1 Aug 2022 13:04:43 -0400
b54ed4
Subject: [PATCH] efi: use EFI_LOADER_(CODE|DATA) for kernel and initrd
b54ed4
 allocations
b54ed4
b54ed4
At some point due to an erroneous kernel warning, we switched kernel and
b54ed4
initramfs to being loaded in EFI_RUNTIME_SERVICES_CODE and
b54ed4
EFI_RUNTIME_SERVICES_DATA memory pools.  This doesn't appear to be
b54ed4
correct according to the spec, and that kernel warning has gone away.
b54ed4
b54ed4
This patch puts them back in EFI_LOADER_CODE and EFI_LOADER_DATA
b54ed4
allocations, respectively.
b54ed4
b54ed4
Resolves: rhbz#2108456
b54ed4
b54ed4
Signed-off-by: Peter Jones <pjones@redhat.com>
b54ed4
(cherry picked from commit 35b5d5fa47bc394c76022e6595b173e68f53225e)
b54ed4
(cherry picked from commit 66e1c922b40957fca488435e06a2f875a219844b)
b54ed4
---
b54ed4
 grub-core/loader/i386/efi/linux.c | 8 ++++----
b54ed4
 1 file changed, 4 insertions(+), 4 deletions(-)
b54ed4
b54ed4
diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c
b54ed4
index 09e7596064..4d39023792 100644
b54ed4
--- a/grub-core/loader/i386/efi/linux.c
b54ed4
+++ b/grub-core/loader/i386/efi/linux.c
b54ed4
@@ -278,7 +278,7 @@ grub_cmd_initrd (grub_command_t cmd, int argc, char *argv[])
b54ed4
     }
b54ed4
 
b54ed4
   grub_dprintf ("linux", "Trying to allocate initrd mem\n");
b54ed4
-  initrd_mem = kernel_alloc(INITRD_MEM, size, GRUB_EFI_RUNTIME_SERVICES_DATA,
b54ed4
+  initrd_mem = kernel_alloc(INITRD_MEM, size, GRUB_EFI_LOADER_DATA,
b54ed4
 			    N_("can't allocate initrd"));
b54ed4
   if (initrd_mem == NULL)
b54ed4
     goto fail;
b54ed4
@@ -457,7 +457,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
b54ed4
 #endif
b54ed4
 
b54ed4
   params = kernel_alloc (KERNEL_MEM, sizeof(*params),
b54ed4
-			 GRUB_EFI_RUNTIME_SERVICES_DATA,
b54ed4
+			 GRUB_EFI_LOADER_DATA,
b54ed4
 			 "cannot allocate kernel parameters");
b54ed4
   if (!params)
b54ed4
     goto fail;
b54ed4
@@ -480,7 +480,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
b54ed4
 
b54ed4
   grub_dprintf ("linux", "setting up cmdline\n");
b54ed4
   cmdline = kernel_alloc (KERNEL_MEM, lh->cmdline_size + 1,
b54ed4
-			  GRUB_EFI_RUNTIME_SERVICES_DATA,
b54ed4
+			  GRUB_EFI_LOADER_DATA,
b54ed4
 			  N_("can't allocate cmdline"));
b54ed4
   if (!cmdline)
b54ed4
     goto fail;
b54ed4
@@ -529,7 +529,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
b54ed4
   kernel_size = lh->init_size;
b54ed4
   grub_dprintf ("linux", "Trying to allocate kernel mem\n");
b54ed4
   kernel_mem = kernel_alloc (KERNEL_MEM, kernel_size,
b54ed4
-			     GRUB_EFI_RUNTIME_SERVICES_CODE,
b54ed4
+			     GRUB_EFI_LOADER_CODE,
b54ed4
 			     N_("can't allocate kernel"));
b54ed4
   restore_addresses();
b54ed4
   if (!kernel_mem)