x86-efi: Fix an incorrect array size in kernel allocation
Resolves: #2031289 Signed-off-by: Robbie Harwood <rharwood@redhat.com>
This commit is contained in:
parent
c1ebf6e8ba
commit
1db6b68958
@ -0,0 +1,37 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Tue, 11 Oct 2022 17:00:50 -0400
|
||||
Subject: [PATCH] x86-efi: Fix an incorrect array size in kernel allocation
|
||||
|
||||
In 81a6ebf62bbe166ddc968463df2e8bd481bf697c ("efi: split allocation
|
||||
policy for kernel vs initrd memories."), I introduced a split in the
|
||||
kernel allocator to allow for different dynamic policies for the kernel
|
||||
and the initrd allocations.
|
||||
|
||||
Unfortunately, that change increased the size of the policy data used to
|
||||
make decisions, but did not change the size of the temporary storage we
|
||||
use to back it up and restore. This results in some of .data getting
|
||||
clobbered at runtime, and hilarity ensues.
|
||||
|
||||
This patch makes the size of the backup storage be based on the size of
|
||||
the initial policy data.
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
(cherry picked from commit 37747b22342499a798ca3a8895770cd93b6e1258)
|
||||
---
|
||||
grub-core/loader/i386/efi/linux.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c
|
||||
index f23b3f7b01..18aadc3e07 100644
|
||||
--- a/grub-core/loader/i386/efi/linux.c
|
||||
+++ b/grub-core/loader/i386/efi/linux.c
|
||||
@@ -93,7 +93,7 @@ static struct allocation_choice max_addresses[] =
|
||||
{ INITRD_MEM, GRUB_EFI_MAX_ALLOCATION_ADDRESS, GRUB_EFI_ALLOCATE_MAX_ADDRESS },
|
||||
{ NO_MEM, 0, 0 }
|
||||
};
|
||||
-static struct allocation_choice saved_addresses[4];
|
||||
+static struct allocation_choice saved_addresses[sizeof(max_addresses) / sizeof(max_addresses[0])];
|
||||
|
||||
#define save_addresses() grub_memcpy(saved_addresses, max_addresses, sizeof(max_addresses))
|
||||
#define restore_addresses() grub_memcpy(max_addresses, saved_addresses, sizeof(max_addresses))
|
@ -287,3 +287,4 @@ Patch0286: 0286-ieee1275-implement-vec5-for-cas-negotiation.patch
|
||||
Patch0287: 0287-squish-don-t-dup-rhgb-quiet-check-mtimes.patch
|
||||
Patch0288: 0288-squish-give-up-on-rhgb-quiet.patch
|
||||
Patch0289: 0289-squish-BLS-only-write-etc-kernel-cmdline-if-writable.patch
|
||||
Patch0290: 0290-x86-efi-Fix-an-incorrect-array-size-in-kernel-alloca.patch
|
||||
|
@ -14,7 +14,7 @@
|
||||
Name: grub2
|
||||
Epoch: 1
|
||||
Version: 2.06
|
||||
Release: 46%{?dist}
|
||||
Release: 47%{?dist}
|
||||
Summary: Bootloader with support for Linux, Multiboot and more
|
||||
License: GPLv3+
|
||||
URL: http://www.gnu.org/software/grub/
|
||||
@ -532,6 +532,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Wed Oct 12 2022 Robbie Harwood <rharwood@redhat.com> - 2.06-47
|
||||
- x86-efi: Fix an incorrect array size in kernel allocation
|
||||
- Resolves: #2031289
|
||||
|
||||
* Thu Aug 25 2022 Robbie Harwood <rharwood@redhat.com> - 2.06-46
|
||||
- Sync /etc/kernel/cmdline generation with 2.06-52.fc38
|
||||
- Resolves: #1969362
|
||||
|
Loading…
Reference in New Issue
Block a user