diff --git a/0001-grub-core-modify-sector-by-sysfs-as-disk-sector.patch b/0001-grub-core-modify-sector-by-sysfs-as-disk-sector.patch new file mode 100644 index 0000000..38eeb64 --- /dev/null +++ b/0001-grub-core-modify-sector-by-sysfs-as-disk-sector.patch @@ -0,0 +1,57 @@ +From 1eee02bbf2c11167e94f424846ce1de0b6e7fa8e Mon Sep 17 00:00:00 2001 +From: Mukesh Kumar Chaurasiya +Date: Fri, 3 Feb 2023 10:10:43 +0530 +Subject: [PATCH] grub-core: modify sector by sysfs as disk sector + +The disk sector size provided by sysfs file system considers the +sector size of 512 irrespective of disk sector size, Thus +causing the read by grub to an incorrect offset from what was +originally intended. + +Considering the 512 sector size of sysfs data the actual sector +needs to be modified corresponding to disk sector size. + +Signed-off-by: Mukesh Kumar Chaurasiya +--- + grub-core/osdep/linux/hostdisk.c | 15 ++++++++++++--- + 1 file changed, 12 insertions(+), 3 deletions(-) + +--- a/grub-core/osdep/linux/hostdisk.c ++++ b/grub-core/osdep/linux/hostdisk.c +@@ -199,8 +199,15 @@ + + #pragma GCC diagnostic ignored "-Wformat-nonliteral" + ++static inline grub_disk_addr_t ++transform_sector (grub_disk_t disk, grub_disk_addr_t sector) ++{ ++ return sector >> (disk->log_sector_size - GRUB_DISK_SECTOR_BITS); ++} ++ + static int +-grub_hostdisk_linux_find_partition (char *dev, grub_disk_addr_t sector) ++grub_hostdisk_linux_find_partition (const grub_disk_t disk, char *dev, ++ grub_disk_addr_t sector) + { + size_t len = strlen (dev); + const char *format; +@@ -265,7 +272,8 @@ + if (fstat (fd, &st) < 0 + || !grub_util_device_is_mapped_stat (&st) + || !grub_util_get_dm_node_linear_info (st.st_rdev, 0, 0, &start)) +- start = grub_util_find_partition_start_os (real_dev); ++ start = transform_sector (disk, ++ grub_util_find_partition_start_os (real_dev)); + /* We don't care about errors here. */ + grub_errno = GRUB_ERR_NONE; + +@@ -346,7 +354,8 @@ + && strncmp (dev, "/dev/", 5) == 0) + { + if (sector >= part_start) +- is_partition = grub_hostdisk_linux_find_partition (dev, part_start); ++ is_partition = grub_hostdisk_linux_find_partition (disk, dev, ++ part_start); + else + *max = part_start - sector; + } diff --git a/0001-grub2-Can-t-setup-a-default-boot-device-correctly-on.patch b/0001-grub2-Can-t-setup-a-default-boot-device-correctly-on.patch new file mode 100644 index 0000000..7f40e4a --- /dev/null +++ b/0001-grub2-Can-t-setup-a-default-boot-device-correctly-on.patch @@ -0,0 +1,44 @@ +From a59b58f6ae327a8f6949991cb5531db01e1ba14d Mon Sep 17 00:00:00 2001 +From: Wen Xiong +Date: Tue, 7 Feb 2023 15:10:15 -0500 +Subject: [PATCH] grub2: Can't setup a default boot device correctly on nvme + device in Beta3 + +The patch in Bug 200486 - SUSE1205666 - SLES15SP5 Beta1: Setup multiple dev path + for a nvmf boot device in grub2 caused the issue. That patch didn't consider +nvme devices carefully. + +The new patch will check "nvme-of" instead of "nvme" to call +build_multi_boot_device(). + +Signed-off-by: Wen Xiong +--- + grub-core/osdep/unix/platform.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/grub-core/osdep/unix/platform.c b/grub-core/osdep/unix/platform.c +index db8fa4b95..fb47c0ffa 100644 +--- a/grub-core/osdep/unix/platform.c ++++ b/grub-core/osdep/unix/platform.c +@@ -288,11 +288,15 @@ grub_install_register_ieee1275 (int is_prep, const char *install_device, + } + *ptr = '\0'; + } +- else if (grub_strstr(install_device, "nvme")) +- boot_device = build_multi_boot_device(install_device); +- else ++ else { + boot_device = get_ofpathname (install_device); + ++ if (grub_strstr(boot_device, "nvme-of")) { ++ free (boot_device); ++ boot_device = build_multi_boot_device(install_device); ++ } ++ } ++ + if (grub_util_exec ((const char * []){ "nvsetenv", "boot-device", + boot_device, NULL })) + { +-- +2.39.1 + diff --git a/0002-AUDIT-0-http-boot-tracker-bug.patch b/0002-AUDIT-0-http-boot-tracker-bug.patch index 65b12ea..040c93d 100644 --- a/0002-AUDIT-0-http-boot-tracker-bug.patch +++ b/0002-AUDIT-0-http-boot-tracker-bug.patch @@ -15,17 +15,17 @@ This is no big issue for pure http boot, since its going to execute an untrusted kernel anyway, but it will break trusted boot scenarios, where only signed code is allowed to be executed. +v2: Fix GCC 13 build failure (bsc#1201089) + Signed-off-by: Michael Chang --- grub-core/net/efi/net.c | 4 +++- grub-core/net/http.c | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) -diff --git a/grub-core/net/efi/net.c b/grub-core/net/efi/net.c -index 0bac343b4..5bc604ff0 100644 --- a/grub-core/net/efi/net.c +++ b/grub-core/net/efi/net.c -@@ -645,8 +645,10 @@ grub_efihttp_chunk_read (grub_file_t file, char *buf, +@@ -654,8 +654,10 @@ rd = efi_net_interface (read, file, chunk, sz); @@ -37,21 +37,19 @@ index 0bac343b4..5bc604ff0 100644 if (buf) { -diff --git a/grub-core/net/http.c b/grub-core/net/http.c -index f182d7b87..5004ecfee 100644 --- a/grub-core/net/http.c +++ b/grub-core/net/http.c -@@ -31,7 +31,8 @@ GRUB_MOD_LICENSE ("GPLv3+"); +@@ -31,7 +31,8 @@ enum { - HTTP_PORT = 80 + HTTP_PORT = 80, -+ HTTP_MAX_CHUNK_SIZE = 0x80000000 ++ HTTP_MAX_CHUNK_SIZE = GRUB_INT_MAX }; -@@ -78,6 +79,8 @@ parse_line (grub_file_t file, http_data_t data, char *ptr, grub_size_t len) +@@ -78,6 +79,8 @@ if (data->in_chunk_len == 2) { data->chunk_rem = grub_strtoul (ptr, 0, 16); @@ -60,6 +58,3 @@ index f182d7b87..5004ecfee 100644 grub_errno = GRUB_ERR_NONE; if (data->chunk_rem == 0) { --- -2.12.0 - diff --git a/grub2.changes b/grub2.changes index 1d29dc5..d6089c4 100644 --- a/grub2.changes +++ b/grub2.changes @@ -1,3 +1,21 @@ +------------------------------------------------------------------- +Wed Feb 8 02:24:16 UTC 2023 - Michael Chang + +- Fix nvmf boot device setup (bsc#1207811) + * 0001-grub2-Can-t-setup-a-default-boot-device-correctly-on.patch + +------------------------------------------------------------------- +Tue Feb 7 02:11:47 UTC 2023 - Michael Chang + +- Fix unknown filesystem error on disks with 4096 sector size (bsc#1207064) + * 0001-grub-core-modify-sector-by-sysfs-as-disk-sector.patch + +------------------------------------------------------------------- +Sat Feb 4 05:57:02 UTC 2023 - Michael Chang + +- Fix GCC 13 build failure (bsc#1201089) + * 0002-AUDIT-0-http-boot-tracker-bug.patch + ------------------------------------------------------------------- Tue Jan 3 02:48:05 UTC 2023 - Gary Ching-Pang Lin diff --git a/grub2.spec b/grub2.spec index 881954b..ef8dbf5 100644 --- a/grub2.spec +++ b/grub2.spec @@ -478,6 +478,8 @@ Patch951: 0002-Mark-environmet-blocks-as-used-for-image-embedding.patch Patch952: 0001-ieee1275-Increase-initially-allocated-heap-from-1-4-.patch Patch953: grub2-increase-crypttab-path-buffer.patch Patch954: 0001-grub2-Set-multiple-device-path-for-a-nvmf-boot-devic.patch +Patch955: 0001-grub-core-modify-sector-by-sysfs-as-disk-sector.patch +Patch956: 0001-grub2-Can-t-setup-a-default-boot-device-correctly-on.patch Requires: gettext-runtime %if 0%{?suse_version} >= 1140