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