mirror of
https://src.fedoraproject.org/rpms/grub2.git
synced 2024-11-28 07:44:52 +00:00
85cfe6dd30
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
57 lines
1.9 KiB
Diff
57 lines
1.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Peter Jones <pjones@redhat.com>
|
|
Date: Mon, 1 Aug 2022 14:07:50 -0400
|
|
Subject: [PATCH] efi: allocate the initrd within the bounds expressed by the
|
|
kernel
|
|
|
|
Currently on x86, only linux kernels built with CONFIG_RELOCATABLE for
|
|
x86_64 can be loaded above 4G, but the maximum address for the initramfs
|
|
is specified via a HdrS field. This allows us to utilize that value,
|
|
and unless loading the kernel above 4G, uses the value present there.
|
|
If loading kernel above 4G is allowed, we assume loading the initramfs
|
|
above 4G also works; in practice this has been true in the kernel code
|
|
for quite some time.
|
|
|
|
Resolves: rhbz#2112134
|
|
|
|
Signed-off-by: Peter Jones <pjones@redhat.com>
|
|
---
|
|
grub-core/loader/i386/efi/linux.c | 6 ++++++
|
|
1 file changed, 6 insertions(+)
|
|
|
|
diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c
|
|
index e6b8998e5e..d003b474ee 100644
|
|
--- a/grub-core/loader/i386/efi/linux.c
|
|
+++ b/grub-core/loader/i386/efi/linux.c
|
|
@@ -190,6 +190,8 @@ grub_linuxefi_unload (void *data)
|
|
cmd_initrdefi->data = 0;
|
|
grub_free (context);
|
|
|
|
+ max_addresses[INITRD_MAX_ADDRESS].addr = GRUB_EFI_MAX_ALLOCATION_ADDRESS;
|
|
+
|
|
return GRUB_ERR_NONE;
|
|
}
|
|
|
|
@@ -426,11 +428,13 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|
}
|
|
#endif
|
|
|
|
+ max_addresses[INITRD_MAX_ADDRESS].addr = lh->initrd_addr_max;
|
|
#if defined(__x86_64__)
|
|
if (lh->xloadflags & LINUX_XLF_CAN_BE_LOADED_ABOVE_4G)
|
|
{
|
|
grub_dprintf ("linux", "Loading kernel above 4GB is supported; enabling.\n");
|
|
max_addresses[KERNEL_NO_LIMIT].addr = GRUB_EFI_MAX_USABLE_ADDRESS;
|
|
+ max_addresses[INITRD_MAX_ADDRESS].addr = GRUB_EFI_MAX_USABLE_ADDRESS;
|
|
}
|
|
else
|
|
{
|
|
@@ -560,6 +564,8 @@ fail:
|
|
|
|
grub_dl_unref (my_mod);
|
|
|
|
+ max_addresses[INITRD_MAX_ADDRESS].addr = GRUB_EFI_MAX_ALLOCATION_ADDRESS;
|
|
+
|
|
if (lh)
|
|
kernel_free (cmdline, lh->cmdline_size + 1);
|
|
|