appendedsig: Fix grub-mkimage with an unaligned appended signature size
Related: #RHEL-24742 Signed-off-by: Nicolas Frayer <nfrayer@redhat.com>
This commit is contained in:
parent
4fba475751
commit
76c8afe3de
@ -0,0 +1,43 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Sudhakar Kuppusamy <sudhakar@linux.ibm.com>
|
||||
Date: Wed, 3 Dec 2025 13:19:57 +0530
|
||||
Subject: [PATCH] appendedsig: Fix grub-mkimage with an unaligned appended
|
||||
signature size
|
||||
|
||||
The grub-mkimage does not add zero padding when creating core.elf with an
|
||||
appended signature size that is not aligned to a multiple of 4 bytes.
|
||||
Firmware is unable to read the magic string "~Module signature appended~"
|
||||
from core.elf.
|
||||
|
||||
To fix this, round an appended signature size + appended signature ELF note
|
||||
size up to the nearest multiple of a 4-byte alignment and truncate it to the
|
||||
appended signature size.
|
||||
|
||||
Example:
|
||||
grub-mkimage -O powerpc-ieee1275 -o core.elf -d grub-core -p /grub2 -x \
|
||||
kernel.der --appended-signature-size 490 ...
|
||||
|
||||
Signed-off-by: Sudhakar Kuppusamy <sudhakar@linux.ibm.com>
|
||||
---
|
||||
util/grub-mkimagexx.c | 8 +++++++-
|
||||
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/util/grub-mkimagexx.c b/util/grub-mkimagexx.c
|
||||
index d12b1ba2bae3..0eb1c3fe88c5 100644
|
||||
--- a/util/grub-mkimagexx.c
|
||||
+++ b/util/grub-mkimagexx.c
|
||||
@@ -247,7 +247,13 @@ SUFFIX (grub_mkimage_generate_elf) (const struct grub_install_image_target_desc
|
||||
if (appsig_size)
|
||||
{
|
||||
phnum++;
|
||||
- footer_size += ALIGN_UP (sizeof (struct grub_appended_signature_note), 4);
|
||||
+ /*
|
||||
+ * Rounds a appended signature size + appended signature note size up to
|
||||
+ * the nearest multiple of a 4-byte alignment.
|
||||
+ */
|
||||
+ footer_size += ALIGN_UP (sizeof (struct grub_appended_signature_note) + appsig_size, 4);
|
||||
+ /* Truncating to appended signature size. */
|
||||
+ footer_size -= appsig_size;
|
||||
}
|
||||
|
||||
if (image_target->id != IMAGE_LOONGSON_ELF)
|
||||
@ -522,3 +522,4 @@ Patch0522: 0522-docs-Write-how-to-import-new-libgcrypt.patch
|
||||
Patch0523: 0523-Appended-sig-Fix-build.patch
|
||||
Patch0524: 0524-docs-fix-some-duplicated-sections.patch
|
||||
Patch0525: 0525-mkimage-Remove-duplicates.patch
|
||||
Patch0526: 0526-appendedsig-Fix-grub-mkimage-with-an-unaligned-appen.patch
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
Name: grub2
|
||||
Epoch: 1
|
||||
Version: 2.06
|
||||
Release: 119%{?dist}
|
||||
Release: 120%{?dist}
|
||||
Summary: Bootloader with support for Linux, Multiboot and more
|
||||
License: GPLv3+
|
||||
URL: http://www.gnu.org/software/grub/
|
||||
@ -538,6 +538,10 @@ fi
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Wed Dec 03 2025 Nicolas Frayer <nfrayer@redhat.com> 2.06-120
|
||||
- appendedsig: Fix grub-mkimage with an unaligned appended signature size
|
||||
- Related: #RHEL-24742
|
||||
|
||||
* Mon Nov 17 2025 Nicolas Frayer <nfrayer@redhat.com> 2.06-119
|
||||
- ieee1275: Upstream patches for appended signature support
|
||||
- Related: #RHEL-24742
|
||||
|
||||
Loading…
Reference in New Issue
Block a user