nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

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

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