isohybrid: Make GPT GUIDs reproducible with --uefi and --id
Resolves: #RHEL-96214 Signed-off-by: Leo Sandoval <lsandova@redhat.com>
This commit is contained in:
parent
6d54aa6cf2
commit
756a438b5b
@ -0,0 +1,78 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Riches <chris.riches@nutanix.com>
|
||||
Date: Fri, 13 Jun 2025 13:10:03 -0600
|
||||
Subject: [PATCH] isohybrid: Make GPT GUIDs reproducible with --uefi and --id
|
||||
|
||||
We already have the --id option to make the MBR ID reproducible,
|
||||
however the GPT GUIDs are always random, making it impossible to
|
||||
hybridise reproducibly with the --uefi option.
|
||||
|
||||
Switch from v4 to v5 UUIDs when --id is set, computing them from the MBR
|
||||
ID via arbitrary fixed namespaces + SHA1 hashing.
|
||||
|
||||
Signed-off-by: Chris Riches <chris.riches at nutanix.com>
|
||||
Signed-off-by: Leo Sandoval <lsandova@redhat.com>
|
||||
---
|
||||
utils/isohybrid.c | 28 +++++++++++++++++++++++++---
|
||||
1 file changed, 25 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/utils/isohybrid.c b/utils/isohybrid.c
|
||||
index 1a203213..681157cd 100644
|
||||
--- a/utils/isohybrid.c
|
||||
+++ b/utils/isohybrid.c
|
||||
@@ -48,6 +48,18 @@ unsigned int padding = 0;
|
||||
|
||||
uuid_t disk_uuid, part_uuid, iso_uuid;
|
||||
|
||||
+UUID_DEFINE(disk_uuid_ns,
|
||||
+ 0x13, 0x40, 0x46, 0xef, 0x45, 0x39, 0x4c, 0xd6,
|
||||
+ 0x83, 0x23, 0x27, 0xa9, 0x23, 0x77, 0x78, 0x68);
|
||||
+
|
||||
+UUID_DEFINE(part_uuid_ns,
|
||||
+ 0x24, 0x08, 0x39, 0x02, 0x5d, 0x03, 0x42, 0x49,
|
||||
+ 0x83, 0xb1, 0x99, 0x76, 0xfb, 0xe7, 0x38, 0x5c);
|
||||
+
|
||||
+UUID_DEFINE(iso_uuid_ns,
|
||||
+ 0x50, 0x3a, 0xbc, 0xed, 0xc7, 0xa4, 0x40, 0x1c,
|
||||
+ 0xa1, 0xe3, 0x2c, 0xf6, 0x85, 0x3f, 0xeb, 0x81);
|
||||
+
|
||||
uint8_t mode = 0;
|
||||
enum { VERBOSE = 1 , EFI = 2 , MAC = 4};
|
||||
|
||||
@@ -775,6 +787,16 @@ uint32_t chksum_crc32 (unsigned char *block, unsigned int length)
|
||||
return (crc ^ 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
+void
|
||||
+gen_uuid(uuid_t out, const uuid_t ns)
|
||||
+{
|
||||
+ if (id) {
|
||||
+ uuid_generate_sha1(out, ns, (char*)&id, sizeof(id));
|
||||
+ } else {
|
||||
+ uuid_generate(out);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
void
|
||||
reverse_uuid(uuid_t uuid)
|
||||
{
|
||||
@@ -815,7 +837,7 @@ initialise_gpt(uint8_t *gpt, uint32_t current, uint32_t alternate, int primary)
|
||||
}
|
||||
|
||||
if (primary) {
|
||||
- uuid_generate(disk_uuid);
|
||||
+ gen_uuid(disk_uuid, disk_uuid_ns);
|
||||
reverse_uuid(disk_uuid);
|
||||
}
|
||||
|
||||
@@ -842,8 +864,8 @@ initialise_gpt(uint8_t *gpt, uint32_t current, uint32_t alternate, int primary)
|
||||
|
||||
part = (struct gpt_part_header *)gpt;
|
||||
if (primary) {
|
||||
- uuid_generate(part_uuid);
|
||||
- uuid_generate(iso_uuid);
|
||||
+ gen_uuid(part_uuid, part_uuid_ns);
|
||||
+ gen_uuid(iso_uuid, iso_uuid_ns);
|
||||
reverse_uuid(part_uuid);
|
||||
reverse_uuid(iso_uuid);
|
||||
}
|
@ -5,3 +5,4 @@ Patch0004: 0004-Add-RPMOPTFLAGS-to-CFLAGS-for-some-stuff.patch
|
||||
Patch0005: 0005-Workaround-multiple-definition-of-symbol-errors.patch
|
||||
Patch0006: 0006-Replace-builtin-strlen-that-appears-to-get-optimized.patch
|
||||
Patch0007: 0007-Fix-backspace-when-editing-a-multiline-cmdline.patch
|
||||
Patch0008: 0008-isohybrid-Make-GPT-GUIDs-reproducible-with-uefi-and-.patch
|
||||
|
@ -7,7 +7,7 @@ Summary: Simple kernel loader which boots from a FAT filesystem
|
||||
Name: syslinux
|
||||
Version: 6.04
|
||||
%define tarball_version 6.04-pre1
|
||||
Release: 0.21%{?dist}
|
||||
Release: 0.22%{?dist}
|
||||
License: GPLv2+
|
||||
URL: http://syslinux.zytor.com/wiki/index.php/The_Syslinux_Project
|
||||
Source0: http://www.kernel.org/pub/linux/utils/boot/syslinux/%{name}-%{tarball_version}.tar.xz
|
||||
@ -253,6 +253,10 @@ fi
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Fri Jun 13 2025 Leo Sandoval <lsandova@redhat.com> - 6.04-0.22
|
||||
- isohybrid: Make GPT GUIDs reproducible with --uefi and --id
|
||||
- Resolves: #RHEL-96214
|
||||
|
||||
* Mon Jun 16 2025 Leo Sandoval <lsandova@redhat.com> - 6.04-0.21
|
||||
- Build tftpboot on x86_64 instead of i686
|
||||
- Resolves: #RHEL-97105
|
||||
|
Loading…
Reference in New Issue
Block a user