SHA256
1
0
forked from pool/grub2

Accepting request 1063542 from home:michael-chang:branches:Base:System

- Fix unknown filesystem error on disks with 4096 sector size (bsc#1207064)
  * 0001-grub-core-modify-sector-by-sysfs-as-disk-sector.patch

- Fix GCC 13 build failure (bsc#1201089)
  * 0002-AUDIT-0-http-boot-tracker-bug.patch

OBS-URL: https://build.opensuse.org/request/show/1063542
OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=436
This commit is contained in:
Michael Chang 2023-02-07 07:20:35 +00:00 committed by Git OBS Bridge
parent cb476353d0
commit a7b06b9f1a
4 changed files with 76 additions and 11 deletions

View File

@ -0,0 +1,57 @@
From 1eee02bbf2c11167e94f424846ce1de0b6e7fa8e Mon Sep 17 00:00:00 2001
From: Mukesh Kumar Chaurasiya <mchauras@linux.vnet.ibm.com>
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 <mchauras@linux.vnet.ibm.com>
---
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;
}

View File

@ -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 <mchang@suse.com>
---
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

View File

@ -1,3 +1,15 @@
-------------------------------------------------------------------
Tue Feb 7 02:11:47 UTC 2023 - Michael Chang <mchang@suse.com>
- 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 <mchang@suse.com>
- 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 <glin@suse.com>

View File

@ -478,6 +478,7 @@ 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
Requires: gettext-runtime
%if 0%{?suse_version} >= 1140