Skip to content

Commit

Permalink
efi: use EFI_LOADER_(CODE|DATA) for kernel and initrd allocations
Browse files Browse the repository at this point in the history
At some point due to an erroneous kernel warning, we switched kernel and
initramfs to being loaded in EFI_RUNTIME_SERVICES_CODE and
EFI_RUNTIME_SERVICES_DATA memory pools.  This doesn't appear to be
correct according to the spec, and that kernel warning has gone away.

This patch puts them back in EFI_LOADER_CODE and EFI_LOADER_DATA
allocations, respectively.

Resolves: rhbz#2108456

Signed-off-by: Peter Jones <pjones@redhat.com>
  • Loading branch information
vathpela committed Aug 2, 2022
1 parent 3e08c35 commit 35b5d5f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions grub-core/loader/i386/efi/linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ grub_cmd_initrd (grub_command_t cmd, int argc, char *argv[])
}

grub_dprintf ("linux", "Trying to allocate initrd mem\n");
initrd_mem = kernel_alloc(INITRD_MEM, size, GRUB_EFI_RUNTIME_SERVICES_DATA,
initrd_mem = kernel_alloc(INITRD_MEM, size, GRUB_EFI_LOADER_DATA,
N_("can't allocate initrd"));
if (initrd_mem == NULL)
goto fail;
Expand Down Expand Up @@ -443,7 +443,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
#endif

params = kernel_alloc (KERNEL_MEM, sizeof(*params),
GRUB_EFI_RUNTIME_SERVICES_DATA,
GRUB_EFI_LOADER_DATA,
"cannot allocate kernel parameters");
if (!params)
goto fail;
Expand All @@ -467,7 +467,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),

grub_dprintf ("linux", "setting up cmdline\n");
cmdline = kernel_alloc (KERNEL_MEM, lh->cmdline_size + 1,
GRUB_EFI_RUNTIME_SERVICES_DATA,
GRUB_EFI_LOADER_DATA,
N_("can't allocate cmdline"));
if (!cmdline)
goto fail;
Expand Down Expand Up @@ -516,7 +516,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
kernel_size = lh->init_size;
grub_dprintf ("linux", "Trying to allocate kernel mem\n");
kernel_mem = kernel_alloc (KERNEL_MEM, kernel_size,
GRUB_EFI_RUNTIME_SERVICES_CODE,
GRUB_EFI_LOADER_CODE,
N_("can't allocate kernel"));
restore_addresses();
if (!kernel_mem)
Expand Down

0 comments on commit 35b5d5f

Please sign in to comment.