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

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