mirror of
https://src.fedoraproject.org/rpms/grub2.git
synced 2024-11-28 07:44:52 +00:00
Fix the 32-bit Arm PE header magic check
Resolves: rhbz#2000756 Signed-off-by: Peter Jones <pjones@redhat.com>
This commit is contained in:
parent
2585ea930f
commit
a09be092dc
3 changed files with 67 additions and 1 deletions
61
0217-Arm-check-for-the-PE-magic-for-the-compiled-arch.patch
Normal file
61
0217-Arm-check-for-the-PE-magic-for-the-compiled-arch.patch
Normal file
|
@ -0,0 +1,61 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Thu, 9 Sep 2021 10:59:28 -0400
|
||||
Subject: [PATCH] Arm: check for the PE magic for the compiled arch
|
||||
|
||||
In "arm64: Fix EFI loader kernel image allocation", Ben fixed the kernel
|
||||
alignment to match the alignment given in the PE header. In doing so, a
|
||||
check for valid PE magic was added, which was hard-coded to the value
|
||||
seen on Aarch64 (GRUB_PE32_PE64_MAGIC).
|
||||
|
||||
Unfortunately, this code is shared between 64-bit and 32-bit, and so
|
||||
that value broke 32-bit Arm systems.
|
||||
|
||||
This patch adds a constant definition for GRUB_PE32_PEXX_MAGIC, which is
|
||||
either GRUB_PE32_PE64_MAGIC or GRUB_PE32_PE32_MAGIC, depending on which
|
||||
platform is being built, and uses it in the header magic check.
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
grub-core/loader/arm64/linux.c | 2 +-
|
||||
include/grub/arm/linux.h | 1 +
|
||||
include/grub/arm64/linux.h | 1 +
|
||||
3 files changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c
|
||||
index 4a252d5e7e9..f18d90bd749 100644
|
||||
--- a/grub-core/loader/arm64/linux.c
|
||||
+++ b/grub-core/loader/arm64/linux.c
|
||||
@@ -322,7 +322,7 @@ parse_pe_header (void *kernel, grub_uint64_t *total_size,
|
||||
|
||||
pe = (void *)((unsigned long)kernel + lh->hdr_offset);
|
||||
|
||||
- if (pe->opt.magic != GRUB_PE32_PE64_MAGIC)
|
||||
+ if (pe->opt.magic != GRUB_PE32_PEXX_MAGIC)
|
||||
return grub_error(GRUB_ERR_BAD_OS, "Invalid PE optional header magic");
|
||||
|
||||
*total_size = pe->opt.image_size;
|
||||
diff --git a/include/grub/arm/linux.h b/include/grub/arm/linux.h
|
||||
index b582f67f661..966a5074f53 100644
|
||||
--- a/include/grub/arm/linux.h
|
||||
+++ b/include/grub/arm/linux.h
|
||||
@@ -44,6 +44,7 @@ struct grub_arm_linux_pe_header
|
||||
|
||||
#if defined(__arm__)
|
||||
# define GRUB_LINUX_ARMXX_MAGIC_SIGNATURE GRUB_LINUX_ARM_MAGIC_SIGNATURE
|
||||
+# define GRUB_PE32_PEXX_MAGIC GRUB_PE32_PE32_MAGIC
|
||||
# define linux_arch_kernel_header linux_arm_kernel_header
|
||||
# define grub_armxx_linux_pe_header grub_arm_linux_pe_header
|
||||
#endif
|
||||
diff --git a/include/grub/arm64/linux.h b/include/grub/arm64/linux.h
|
||||
index ea030312df3..422bf2bf24b 100644
|
||||
--- a/include/grub/arm64/linux.h
|
||||
+++ b/include/grub/arm64/linux.h
|
||||
@@ -48,6 +48,7 @@ struct grub_arm64_linux_pe_header
|
||||
|
||||
#if defined(__aarch64__)
|
||||
# define GRUB_LINUX_ARMXX_MAGIC_SIGNATURE GRUB_LINUX_ARM64_MAGIC_SIGNATURE
|
||||
+# define GRUB_PE32_PEXX_MAGIC GRUB_PE32_PE64_MAGIC
|
||||
# define linux_arch_kernel_header linux_arm64_kernel_header
|
||||
# define grub_armxx_linux_pe_header grub_arm64_linux_pe_header
|
||||
#endif
|
|
@ -214,3 +214,4 @@ Patch0213: 0213-Remove-outdated-URL-for-BLS-document.patch
|
|||
Patch0214: 0214-templates-Check-for-EFI-at-runtime-instead-of-config.patch
|
||||
Patch0215: 0215-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch
|
||||
Patch0216: 0216-arm64-Fix-EFI-loader-kernel-image-allocation.patch
|
||||
Patch0217: 0217-Arm-check-for-the-PE-magic-for-the-compiled-arch.patch
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
Name: grub2
|
||||
Epoch: 1
|
||||
Version: 2.06
|
||||
Release: 4%{?dist}
|
||||
Release: 5%{?dist}
|
||||
Summary: Bootloader with support for Linux, Multiboot and more
|
||||
License: GPLv3+
|
||||
URL: http://www.gnu.org/software/grub/
|
||||
|
@ -523,6 +523,10 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg
|
|||
%endif
|
||||
|
||||
%changelog
|
||||
* Thu Sep 09 2021 Peter Jones <pjones@redhat.com> - 2.06-5
|
||||
- Fix the 32-bit Arm PE header magic check
|
||||
Resolves: rhbz#2000756
|
||||
|
||||
* Tue Aug 24 2021 Peter Jones <pjones@redhat.com> - 2.06-4
|
||||
- Fix aarch64 kernel alignment.
|
||||
- Fix annobin regexp on ppc64le
|
||||
|
|
Loading…
Reference in a new issue