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

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