fs/xfs/ppc64le: Update xfs code to fix install on 4KB block size
Resolves: #RHEL-142208 Signed-off-by: Renaud Métrich <rmetrich@redhat.com> Signed-off-by: Nicolas Frayer <nfrayer@redhat.com>
This commit is contained in:
parent
aa68f3c873
commit
4775d04747
399
0679-disk-Rename-grub_disk_get_size-to-grub_disk_native_s.patch
Normal file
399
0679-disk-Rename-grub_disk_get_size-to-grub_disk_native_s.patch
Normal file
@ -0,0 +1,399 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Glenn Washburn <development@efficientek.com>
|
||||
Date: Tue, 8 Dec 2020 16:45:32 -0600
|
||||
Subject: [PATCH] disk: Rename grub_disk_get_size() to
|
||||
grub_disk_native_sectors()
|
||||
|
||||
The function grub_disk_get_size() is confusingly named because it actually
|
||||
returns a sector count where the sectors are sized in the GRUB native sector
|
||||
size. Rename to something more appropriate.
|
||||
|
||||
Suggested-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Glenn Washburn <development@efficientek.com>
|
||||
Reviewed-by: Patrick Steinhardt <ps@pks.im>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
---
|
||||
grub-core/disk/diskfilter.c | 12 ++++++------
|
||||
grub-core/disk/dmraid_nvidia.c | 2 +-
|
||||
grub-core/disk/efi/efidisk.c | 2 +-
|
||||
grub-core/disk/geli.c | 6 +++---
|
||||
grub-core/disk/ldm.c | 4 ++--
|
||||
grub-core/disk/luks.c | 2 +-
|
||||
grub-core/disk/mdraid1x_linux.c | 2 +-
|
||||
grub-core/disk/mdraid_linux.c | 2 +-
|
||||
grub-core/fs/cbfs.c | 16 ++++++++--------
|
||||
grub-core/fs/nilfs2.c | 2 +-
|
||||
grub-core/fs/zfs/zfs.c | 4 ++--
|
||||
grub-core/kern/disk.c | 2 +-
|
||||
grub-core/kern/mips/arc/init.c | 2 +-
|
||||
grub-core/normal/misc.c | 6 +++---
|
||||
grub-core/osdep/windows/platform.c | 2 +-
|
||||
include/grub/disk.h | 4 ++--
|
||||
util/grub-install.c | 2 +-
|
||||
util/grub-probe.c | 2 +-
|
||||
18 files changed, 37 insertions(+), 37 deletions(-)
|
||||
|
||||
diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c
|
||||
index a881aa2c9c73..1a4c4aba56f0 100644
|
||||
--- a/grub-core/disk/diskfilter.c
|
||||
+++ b/grub-core/disk/diskfilter.c
|
||||
@@ -149,7 +149,7 @@ scan_disk_partition_iter (grub_disk_t disk, grub_partition_t p, void *data)
|
||||
if (m->disk && m->disk->id == disk->id
|
||||
&& m->disk->dev->id == disk->dev->id
|
||||
&& m->part_start == grub_partition_get_start (disk->partition)
|
||||
- && m->part_size == grub_disk_get_size (disk))
|
||||
+ && m->part_size == grub_disk_native_sectors (disk))
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1194,13 +1194,13 @@ insert_array (grub_disk_t disk, const struct grub_diskfilter_pv_id *id,
|
||||
|
||||
grub_dprintf ("diskfilter", "Inserting %s (+%lld,%lld) into %s (%s)\n", disk->name,
|
||||
(unsigned long long) grub_partition_get_start (disk->partition),
|
||||
- (unsigned long long) grub_disk_get_size (disk),
|
||||
+ (unsigned long long) grub_disk_native_sectors (disk),
|
||||
array->name, diskfilter->name);
|
||||
#ifdef GRUB_UTIL
|
||||
grub_util_info ("Inserting %s (+%" GRUB_HOST_PRIuLONG_LONG ",%"
|
||||
GRUB_HOST_PRIuLONG_LONG ") into %s (%s)\n", disk->name,
|
||||
(unsigned long long) grub_partition_get_start (disk->partition),
|
||||
- (unsigned long long) grub_disk_get_size (disk),
|
||||
+ (unsigned long long) grub_disk_native_sectors (disk),
|
||||
array->name, diskfilter->name);
|
||||
array->driver = diskfilter;
|
||||
#endif
|
||||
@@ -1214,7 +1214,7 @@ insert_array (grub_disk_t disk, const struct grub_diskfilter_pv_id *id,
|
||||
struct grub_diskfilter_lv *lv;
|
||||
/* FIXME: Check whether the update time of the superblocks are
|
||||
the same. */
|
||||
- if (pv->disk && grub_disk_get_size (disk) >= pv->part_size)
|
||||
+ if (pv->disk && grub_disk_native_sectors (disk) >= pv->part_size)
|
||||
return GRUB_ERR_NONE;
|
||||
pv->disk = grub_disk_open (disk->name);
|
||||
if (!pv->disk)
|
||||
@@ -1223,7 +1223,7 @@ insert_array (grub_disk_t disk, const struct grub_diskfilter_pv_id *id,
|
||||
raid device, we shouldn't change it. */
|
||||
pv->start_sector -= pv->part_start;
|
||||
pv->part_start = grub_partition_get_start (disk->partition);
|
||||
- pv->part_size = grub_disk_get_size (disk);
|
||||
+ pv->part_size = grub_disk_native_sectors (disk);
|
||||
|
||||
#ifdef GRUB_UTIL
|
||||
{
|
||||
@@ -1315,7 +1315,7 @@ grub_diskfilter_get_pv_from_disk (grub_disk_t disk,
|
||||
if (pv->disk && pv->disk->id == disk->id
|
||||
&& pv->disk->dev->id == disk->dev->id
|
||||
&& pv->part_start == grub_partition_get_start (disk->partition)
|
||||
- && pv->part_size == grub_disk_get_size (disk))
|
||||
+ && pv->part_size == grub_disk_native_sectors (disk))
|
||||
{
|
||||
if (vg_out)
|
||||
*vg_out = vg;
|
||||
diff --git a/grub-core/disk/dmraid_nvidia.c b/grub-core/disk/dmraid_nvidia.c
|
||||
index 06027912453b..4d2fb04d1265 100644
|
||||
--- a/grub-core/disk/dmraid_nvidia.c
|
||||
+++ b/grub-core/disk/dmraid_nvidia.c
|
||||
@@ -107,7 +107,7 @@ grub_dmraid_nv_detect (grub_disk_t disk,
|
||||
/* Skip partition. */
|
||||
return NULL;
|
||||
|
||||
- sector = grub_disk_get_size (disk);
|
||||
+ sector = grub_disk_native_sectors (disk);
|
||||
if (sector == GRUB_DISK_SIZE_UNKNOWN)
|
||||
/* Not raid. */
|
||||
return NULL;
|
||||
diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c
|
||||
index 720a23fcca63..ea8d70a8d127 100644
|
||||
--- a/grub-core/disk/efi/efidisk.c
|
||||
+++ b/grub-core/disk/efi/efidisk.c
|
||||
@@ -871,7 +871,7 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle)
|
||||
if (ctx.hd->partition_start == 0
|
||||
&& (ctx.hd->partition_size << (parent->log_sector_size
|
||||
- GRUB_DISK_SECTOR_BITS))
|
||||
- == grub_disk_get_size (parent))
|
||||
+ == grub_disk_native_sectors (parent))
|
||||
{
|
||||
dev_name = grub_strdup (parent->name);
|
||||
}
|
||||
diff --git a/grub-core/disk/geli.c b/grub-core/disk/geli.c
|
||||
index e9d23299a538..3281b1d40482 100644
|
||||
--- a/grub-core/disk/geli.c
|
||||
+++ b/grub-core/disk/geli.c
|
||||
@@ -258,7 +258,7 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid,
|
||||
if (2 * GRUB_MD_SHA256->mdlen + 1 > GRUB_CRYPTODISK_MAX_UUID_LENGTH)
|
||||
return NULL;
|
||||
|
||||
- sector = grub_disk_get_size (disk);
|
||||
+ sector = grub_disk_native_sectors (disk);
|
||||
if (sector == GRUB_DISK_SIZE_UNKNOWN || sector == 0)
|
||||
return NULL;
|
||||
|
||||
@@ -391,7 +391,7 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid,
|
||||
|
||||
newdev->modname = "geli";
|
||||
|
||||
- newdev->total_length = grub_disk_get_size (disk) - 1;
|
||||
+ newdev->total_length = grub_disk_native_sectors (disk) - 1;
|
||||
grub_memcpy (newdev->uuid, uuid, sizeof (newdev->uuid));
|
||||
COMPILE_TIME_ASSERT (sizeof (newdev->uuid) >= 32 * 2 + 1);
|
||||
return newdev;
|
||||
@@ -420,7 +420,7 @@ recover_key (grub_disk_t source, grub_cryptodisk_t dev)
|
||||
if (dev->hash->mdlen > GRUB_CRYPTO_MAX_MDLEN)
|
||||
return grub_error (GRUB_ERR_BUG, "mdlen is too long");
|
||||
|
||||
- sector = grub_disk_get_size (source);
|
||||
+ sector = grub_disk_native_sectors (source);
|
||||
if (sector == GRUB_DISK_SIZE_UNKNOWN || sector == 0)
|
||||
return grub_error (GRUB_ERR_BUG, "not a geli");
|
||||
|
||||
diff --git a/grub-core/disk/ldm.c b/grub-core/disk/ldm.c
|
||||
index 1510fb35a765..6ba5d73af0f0 100644
|
||||
--- a/grub-core/disk/ldm.c
|
||||
+++ b/grub-core/disk/ldm.c
|
||||
@@ -898,7 +898,7 @@ grub_ldm_detect (grub_disk_t disk,
|
||||
/* LDM is never inside a partition. */
|
||||
if (!has_ldm || disk->partition)
|
||||
continue;
|
||||
- sector = grub_disk_get_size (disk);
|
||||
+ sector = grub_disk_native_sectors (disk);
|
||||
if (sector == GRUB_DISK_SIZE_UNKNOWN)
|
||||
continue;
|
||||
sector--;
|
||||
@@ -1015,7 +1015,7 @@ grub_util_is_ldm (grub_disk_t disk)
|
||||
/* LDM is never inside a partition. */
|
||||
if (!has_ldm || disk->partition)
|
||||
continue;
|
||||
- sector = grub_disk_get_size (disk);
|
||||
+ sector = grub_disk_native_sectors (disk);
|
||||
if (sector == GRUB_DISK_SIZE_UNKNOWN)
|
||||
continue;
|
||||
sector--;
|
||||
diff --git a/grub-core/disk/luks.c b/grub-core/disk/luks.c
|
||||
index 18b3a8bb1d3f..ef5130c512d2 100644
|
||||
--- a/grub-core/disk/luks.c
|
||||
+++ b/grub-core/disk/luks.c
|
||||
@@ -300,7 +300,7 @@ configure_ciphers (grub_disk_t disk, const char *check_uuid,
|
||||
newdev->essiv_hash = essiv_hash;
|
||||
newdev->hash = hash;
|
||||
newdev->log_sector_size = 9;
|
||||
- newdev->total_length = grub_disk_get_size (disk) - newdev->offset;
|
||||
+ newdev->total_length = grub_disk_native_sectors (disk) - newdev->offset;
|
||||
grub_memcpy (newdev->uuid, uuid, sizeof (newdev->uuid));
|
||||
newdev->modname = "luks";
|
||||
COMPILE_TIME_ASSERT (sizeof (newdev->uuid) >= sizeof (uuid));
|
||||
diff --git a/grub-core/disk/mdraid1x_linux.c b/grub-core/disk/mdraid1x_linux.c
|
||||
index 7cc80d3df39f..2c83f99fd8ea 100644
|
||||
--- a/grub-core/disk/mdraid1x_linux.c
|
||||
+++ b/grub-core/disk/mdraid1x_linux.c
|
||||
@@ -111,7 +111,7 @@ grub_mdraid_detect (grub_disk_t disk,
|
||||
grub_uint64_t size;
|
||||
grub_uint8_t minor_version;
|
||||
|
||||
- size = grub_disk_get_size (disk);
|
||||
+ size = grub_disk_native_sectors (disk);
|
||||
|
||||
/* Check for an 1.x superblock.
|
||||
* It's always aligned to a 4K boundary
|
||||
diff --git a/grub-core/disk/mdraid_linux.c b/grub-core/disk/mdraid_linux.c
|
||||
index 11024ae31e06..e40216f51117 100644
|
||||
--- a/grub-core/disk/mdraid_linux.c
|
||||
+++ b/grub-core/disk/mdraid_linux.c
|
||||
@@ -190,7 +190,7 @@ grub_mdraid_detect (grub_disk_t disk,
|
||||
struct grub_diskfilter_vg *ret;
|
||||
|
||||
/* The sector where the mdraid 0.90 superblock is stored, if available. */
|
||||
- size = grub_disk_get_size (disk);
|
||||
+ size = grub_disk_native_sectors (disk);
|
||||
if (size == GRUB_DISK_SIZE_UNKNOWN)
|
||||
/* not 0.9x raid. */
|
||||
return NULL;
|
||||
diff --git a/grub-core/fs/cbfs.c b/grub-core/fs/cbfs.c
|
||||
index c82980375c83..8f02425d9b52 100644
|
||||
--- a/grub-core/fs/cbfs.c
|
||||
+++ b/grub-core/fs/cbfs.c
|
||||
@@ -149,16 +149,16 @@ grub_cbfs_mount (grub_disk_t disk)
|
||||
grub_off_t header_off;
|
||||
struct cbfs_header head;
|
||||
|
||||
- if (grub_disk_get_size (disk) == GRUB_DISK_SIZE_UNKNOWN)
|
||||
+ if (grub_disk_native_sectors (disk) == GRUB_DISK_SIZE_UNKNOWN)
|
||||
goto fail;
|
||||
|
||||
- if (grub_disk_read (disk, grub_disk_get_size (disk) - 1,
|
||||
+ if (grub_disk_read (disk, grub_disk_native_sectors (disk) - 1,
|
||||
GRUB_DISK_SECTOR_SIZE - sizeof (ptr),
|
||||
sizeof (ptr), &ptr))
|
||||
goto fail;
|
||||
|
||||
ptr = grub_cpu_to_le32 (ptr);
|
||||
- header_off = (grub_disk_get_size (disk) << GRUB_DISK_SECTOR_BITS)
|
||||
+ header_off = (grub_disk_native_sectors (disk) << GRUB_DISK_SECTOR_BITS)
|
||||
+ (grub_int32_t) ptr;
|
||||
|
||||
if (grub_disk_read (disk, 0, header_off,
|
||||
@@ -172,16 +172,16 @@ grub_cbfs_mount (grub_disk_t disk)
|
||||
if (!data)
|
||||
goto fail;
|
||||
|
||||
- data->cbfs_start = (grub_disk_get_size (disk) << GRUB_DISK_SECTOR_BITS)
|
||||
+ data->cbfs_start = (grub_disk_native_sectors (disk) << GRUB_DISK_SECTOR_BITS)
|
||||
- (grub_be_to_cpu32 (head.romsize) - grub_be_to_cpu32 (head.offset));
|
||||
- data->cbfs_end = (grub_disk_get_size (disk) << GRUB_DISK_SECTOR_BITS)
|
||||
+ data->cbfs_end = (grub_disk_native_sectors (disk) << GRUB_DISK_SECTOR_BITS)
|
||||
- grub_be_to_cpu32 (head.bootblocksize);
|
||||
data->cbfs_align = grub_be_to_cpu32 (head.align);
|
||||
|
||||
- if (data->cbfs_start >= (grub_disk_get_size (disk) << GRUB_DISK_SECTOR_BITS))
|
||||
+ if (data->cbfs_start >= (grub_disk_native_sectors (disk) << GRUB_DISK_SECTOR_BITS))
|
||||
goto fail;
|
||||
- if (data->cbfs_end > (grub_disk_get_size (disk) << GRUB_DISK_SECTOR_BITS))
|
||||
- data->cbfs_end = (grub_disk_get_size (disk) << GRUB_DISK_SECTOR_BITS);
|
||||
+ if (data->cbfs_end > (grub_disk_native_sectors (disk) << GRUB_DISK_SECTOR_BITS))
|
||||
+ data->cbfs_end = (grub_disk_native_sectors (disk) << GRUB_DISK_SECTOR_BITS);
|
||||
|
||||
data->next_hofs = data->cbfs_start;
|
||||
|
||||
diff --git a/grub-core/fs/nilfs2.c b/grub-core/fs/nilfs2.c
|
||||
index 6aaa5b9390f1..fdcd23272335 100644
|
||||
--- a/grub-core/fs/nilfs2.c
|
||||
+++ b/grub-core/fs/nilfs2.c
|
||||
@@ -772,7 +772,7 @@ grub_nilfs2_load_sb (struct grub_nilfs2_data *data)
|
||||
partition_size = (grub_le_to_cpu64 (data->sblock.s_dev_size)
|
||||
>> GRUB_DISK_SECTOR_BITS);
|
||||
else
|
||||
- partition_size = grub_disk_get_size (disk);
|
||||
+ partition_size = grub_disk_native_sectors (disk);
|
||||
if (partition_size != GRUB_DISK_SIZE_UNKNOWN)
|
||||
{
|
||||
/* Read second super block. */
|
||||
diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c
|
||||
index de6e26fb4336..738dd5065905 100644
|
||||
--- a/grub-core/fs/zfs/zfs.c
|
||||
+++ b/grub-core/fs/zfs/zfs.c
|
||||
@@ -1179,7 +1179,7 @@ scan_disk (grub_device_t dev, struct grub_zfs_data *data,
|
||||
desc.original = original;
|
||||
|
||||
/* Don't check back labels on CDROM. */
|
||||
- if (grub_disk_get_size (dev->disk) == GRUB_DISK_SIZE_UNKNOWN)
|
||||
+ if (grub_disk_native_sectors (dev->disk) == GRUB_DISK_SIZE_UNKNOWN)
|
||||
vdevnum = VDEV_LABELS / 2;
|
||||
|
||||
for (label = 0; ubbest == NULL && label < vdevnum; label++)
|
||||
@@ -1188,7 +1188,7 @@ scan_disk (grub_device_t dev, struct grub_zfs_data *data,
|
||||
= label * (sizeof (vdev_label_t) >> SPA_MINBLOCKSHIFT)
|
||||
+ ((VDEV_SKIP_SIZE + VDEV_BOOT_HEADER_SIZE) >> SPA_MINBLOCKSHIFT)
|
||||
+ (label < VDEV_LABELS / 2 ? 0 :
|
||||
- ALIGN_DOWN (grub_disk_get_size (dev->disk), sizeof (vdev_label_t))
|
||||
+ ALIGN_DOWN (grub_disk_native_sectors (dev->disk), sizeof (vdev_label_t))
|
||||
- VDEV_LABELS * (sizeof (vdev_label_t) >> SPA_MINBLOCKSHIFT));
|
||||
|
||||
/* Read in the uberblock ring (128K). */
|
||||
diff --git a/grub-core/kern/disk.c b/grub-core/kern/disk.c
|
||||
index 62d6a85cc28c..e26b61f69b8a 100644
|
||||
--- a/grub-core/kern/disk.c
|
||||
+++ b/grub-core/kern/disk.c
|
||||
@@ -550,7 +550,7 @@ grub_disk_read (grub_disk_t disk, grub_disk_addr_t sector,
|
||||
}
|
||||
|
||||
grub_uint64_t
|
||||
-grub_disk_get_size (grub_disk_t disk)
|
||||
+grub_disk_native_sectors (grub_disk_t disk)
|
||||
{
|
||||
if (disk->partition)
|
||||
return grub_partition_get_len (disk->partition);
|
||||
diff --git a/grub-core/kern/mips/arc/init.c b/grub-core/kern/mips/arc/init.c
|
||||
index 86b3a25ec403..5c40c34078d5 100644
|
||||
--- a/grub-core/kern/mips/arc/init.c
|
||||
+++ b/grub-core/kern/mips/arc/init.c
|
||||
@@ -430,7 +430,7 @@ grub_machine_get_bootlocation (char **device, char **path)
|
||||
}
|
||||
|
||||
if (poff == 0
|
||||
- && pend == grub_disk_get_size (parent))
|
||||
+ && pend == grub_disk_native_sectors (parent))
|
||||
{
|
||||
grub_disk_close (parent);
|
||||
*device = dname;
|
||||
diff --git a/grub-core/normal/misc.c b/grub-core/normal/misc.c
|
||||
index 38f91b9b9837..ae63d1ebacc3 100644
|
||||
--- a/grub-core/normal/misc.c
|
||||
+++ b/grub-core/normal/misc.c
|
||||
@@ -176,14 +176,14 @@ grub_normal_print_device_info (const char *name)
|
||||
(grub_partition_get_start (dev->disk->partition) & 1) ? ".5" : "" );
|
||||
else
|
||||
grub_printf_ (N_(" - Sector size %uB"), 1 << dev->disk->log_sector_size);
|
||||
- if (grub_disk_get_size (dev->disk) == GRUB_DISK_SIZE_UNKNOWN)
|
||||
+ if (grub_disk_native_sectors (dev->disk) == GRUB_DISK_SIZE_UNKNOWN)
|
||||
grub_puts_ (N_(" - Total size unknown"));
|
||||
else
|
||||
grub_printf (_(" - Total size %llu%sKiB"),
|
||||
- (unsigned long long) (grub_disk_get_size (dev->disk) >> 1),
|
||||
+ (unsigned long long) (grub_disk_native_sectors (dev->disk) >> 1),
|
||||
/* TRANSLATORS: Replace dot with appropriate decimal separator for
|
||||
your language. */
|
||||
- (grub_disk_get_size (dev->disk) & 1) ? _(".5") : "");
|
||||
+ (grub_disk_native_sectors (dev->disk) & 1) ? _(".5") : "");
|
||||
}
|
||||
|
||||
if (dev)
|
||||
diff --git a/grub-core/osdep/windows/platform.c b/grub-core/osdep/windows/platform.c
|
||||
index 04e0eda9aeb9..0cb9d1b7d007 100644
|
||||
--- a/grub-core/osdep/windows/platform.c
|
||||
+++ b/grub-core/osdep/windows/platform.c
|
||||
@@ -371,7 +371,7 @@ grub_install_register_efi (grub_device_t efidir_grub_dev,
|
||||
|
||||
hddp->partition_start = grub_partition_get_start (efidir_grub_dev->disk->partition)
|
||||
>> (efidir_grub_dev->disk->log_sector_size - GRUB_DISK_SECTOR_BITS);
|
||||
- hddp->partition_size = grub_disk_get_size (efidir_grub_dev->disk)
|
||||
+ hddp->partition_size = grub_disk_native_sectors (efidir_grub_dev->disk)
|
||||
>> (efidir_grub_dev->disk->log_sector_size - GRUB_DISK_SECTOR_BITS);
|
||||
|
||||
pathptr = hddp + 1;
|
||||
diff --git a/include/grub/disk.h b/include/grub/disk.h
|
||||
index b385af826fc4..0e0c4f430497 100644
|
||||
--- a/include/grub/disk.h
|
||||
+++ b/include/grub/disk.h
|
||||
@@ -170,7 +170,7 @@ typedef struct grub_disk_memberlist *grub_disk_memberlist_t;
|
||||
|
||||
#define GRUB_DISK_MAX_MAX_AGGLOMERATE ((1 << (30 - GRUB_DISK_CACHE_BITS - GRUB_DISK_SECTOR_BITS)) - 1)
|
||||
|
||||
-/* Return value of grub_disk_get_size() in case disk size is unknown. */
|
||||
+/* Return value of grub_disk_native_sectors() in case disk size is unknown. */
|
||||
#define GRUB_DISK_SIZE_UNKNOWN 0xffffffffffffffffULL
|
||||
|
||||
/* This is called from the memory manager. */
|
||||
@@ -211,7 +211,7 @@ extern grub_err_t (*EXPORT_VAR(grub_disk_write_weak)) (grub_disk_t disk,
|
||||
const void *buf);
|
||||
|
||||
|
||||
-grub_uint64_t EXPORT_FUNC(grub_disk_get_size) (grub_disk_t disk);
|
||||
+grub_uint64_t EXPORT_FUNC(grub_disk_native_sectors) (grub_disk_t disk);
|
||||
|
||||
#if DISK_CACHE_STATS
|
||||
void
|
||||
diff --git a/util/grub-install.c b/util/grub-install.c
|
||||
index 65bb2f99ef1f..eb49a36c5fba 100644
|
||||
--- a/util/grub-install.c
|
||||
+++ b/util/grub-install.c
|
||||
@@ -737,7 +737,7 @@ is_prep_empty (grub_device_t dev)
|
||||
grub_disk_addr_t dsize, addr;
|
||||
grub_uint32_t buffer[32768];
|
||||
|
||||
- dsize = grub_disk_get_size (dev->disk);
|
||||
+ dsize = grub_disk_native_sectors (dev->disk);
|
||||
for (addr = 0; addr < dsize;
|
||||
addr += sizeof (buffer) / GRUB_DISK_SECTOR_SIZE)
|
||||
{
|
||||
diff --git a/util/grub-probe.c b/util/grub-probe.c
|
||||
index 2a8c2cdffd50..e2e45e16a15e 100644
|
||||
--- a/util/grub-probe.c
|
||||
+++ b/util/grub-probe.c
|
||||
@@ -398,7 +398,7 @@ probe (const char *path, char **device_names, char delim)
|
||||
if (! dev || !dev->disk)
|
||||
grub_util_error ("%s", grub_errmsg);
|
||||
|
||||
- dsize = grub_disk_get_size (dev->disk);
|
||||
+ dsize = grub_disk_native_sectors (dev->disk);
|
||||
for (addr = 0; addr < dsize;
|
||||
addr += sizeof (buffer) / GRUB_DISK_SECTOR_SIZE)
|
||||
{
|
||||
@ -0,0 +1,45 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Glenn Washburn <development@efficientek.com>
|
||||
Date: Mon, 23 Nov 2020 03:27:42 -0600
|
||||
Subject: [PATCH] fs: Fix block lists not being able to address to end of disk
|
||||
sometimes
|
||||
|
||||
When checking if a block list goes past the end of the disk, make sure
|
||||
the total size of the disk is in GRUB native sector sizes, otherwise there
|
||||
will be blocks at the end of the disk inaccessible by block lists.
|
||||
|
||||
Signed-off-by: Glenn Washburn <development@efficientek.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
---
|
||||
grub-core/kern/fs.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/kern/fs.c b/grub-core/kern/fs.c
|
||||
index 730d21770f2b..84d2f14fb88a 100644
|
||||
--- a/grub-core/kern/fs.c
|
||||
+++ b/grub-core/kern/fs.c
|
||||
@@ -139,6 +139,7 @@ grub_fs_blocklist_open (grub_file_t file, const char *name)
|
||||
unsigned i;
|
||||
grub_disk_t disk = file->device->disk;
|
||||
struct grub_fs_block *blocks;
|
||||
+ grub_size_t max_sectors;
|
||||
|
||||
/* First, count the number of blocks. */
|
||||
do
|
||||
@@ -156,6 +157,7 @@ grub_fs_blocklist_open (grub_file_t file, const char *name)
|
||||
return 0;
|
||||
|
||||
file->size = 0;
|
||||
+ max_sectors = grub_disk_from_native_sector (disk, disk->total_sectors);
|
||||
p = (char *) name;
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
@@ -181,7 +183,7 @@ grub_fs_blocklist_open (grub_file_t file, const char *name)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
- if (disk->total_sectors < blocks[i].offset + blocks[i].length)
|
||||
+ if (max_sectors < blocks[i].offset + blocks[i].length)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FILENAME, "beyond the total sectors");
|
||||
goto fail;
|
||||
@ -0,0 +1,70 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Mukesh Kumar Chaurasiya <mchauras@linux.vnet.ibm.com>
|
||||
Date: Thu, 9 Feb 2023 13:09:16 +0530
|
||||
Subject: [PATCH] osdep/linux/hostdisk: 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
|
||||
the 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>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
(cherry picked from commit f7564844f82b57078d601befadc438b5bc1fa01b)
|
||||
---
|
||||
grub-core/osdep/linux/hostdisk.c | 7 ++++---
|
||||
include/grub/disk.h | 7 +++++++
|
||||
2 files changed, 11 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/grub-core/osdep/linux/hostdisk.c b/grub-core/osdep/linux/hostdisk.c
|
||||
index 06179fca7258..9b3030765b1f 100644
|
||||
--- a/grub-core/osdep/linux/hostdisk.c
|
||||
+++ b/grub-core/osdep/linux/hostdisk.c
|
||||
@@ -240,7 +240,8 @@ have_devfs (void)
|
||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||
|
||||
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;
|
||||
@@ -305,7 +306,7 @@ grub_hostdisk_linux_find_partition (char *dev, grub_disk_addr_t sector)
|
||||
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 = grub_disk_to_native_sector (disk, grub_util_find_partition_start_os (real_dev));
|
||||
/* We don't care about errors here. */
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
|
||||
@@ -382,7 +383,7 @@ grub_util_fd_open_device (const grub_disk_t disk, grub_disk_addr_t sector, int f
|
||||
&& 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/include/grub/disk.h b/include/grub/disk.h
|
||||
index 0e0c4f430497..4d3c2e571ef8 100644
|
||||
--- a/include/grub/disk.h
|
||||
+++ b/include/grub/disk.h
|
||||
@@ -173,6 +173,13 @@ typedef struct grub_disk_memberlist *grub_disk_memberlist_t;
|
||||
/* Return value of grub_disk_native_sectors() in case disk size is unknown. */
|
||||
#define GRUB_DISK_SIZE_UNKNOWN 0xffffffffffffffffULL
|
||||
|
||||
+/* Convert from GRUB native disk sized sector to disk sized sector. */
|
||||
+static inline grub_disk_addr_t
|
||||
+grub_disk_to_native_sector (grub_disk_t disk, grub_disk_addr_t sector)
|
||||
+{
|
||||
+ return sector >> (disk->log_sector_size - GRUB_DISK_SECTOR_BITS);
|
||||
+}
|
||||
+
|
||||
/* This is called from the memory manager. */
|
||||
void grub_disk_cache_invalidate_all (void);
|
||||
|
||||
@ -0,0 +1,67 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Glenn Washburn <development@efficientek.com>
|
||||
Date: Mon, 7 Sep 2020 17:27:59 +0200
|
||||
Subject: [PATCH] cryptodisk: Fix incorrect calculation of start sector
|
||||
|
||||
Here dev is a grub_cryptodisk_t and dev->offset is offset in sectors of size
|
||||
native to the cryptodisk device. The sector is correctly transformed into
|
||||
native grub sector size, but then added to dev->offset which is not
|
||||
transformed. It would be nice if the type system would help us with this.
|
||||
|
||||
Signed-off-by: Glenn Washburn <development@efficientek.com>
|
||||
Reviewed-by: Patrick Steinhardt <ps@pks.im>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
---
|
||||
grub-core/disk/cryptodisk.c | 11 ++++-------
|
||||
include/grub/disk.h | 7 +++++++
|
||||
2 files changed, 11 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/grub-core/disk/cryptodisk.c b/grub-core/disk/cryptodisk.c
|
||||
index 871640685d73..f4fd59095f6c 100644
|
||||
--- a/grub-core/disk/cryptodisk.c
|
||||
+++ b/grub-core/disk/cryptodisk.c
|
||||
@@ -597,9 +597,8 @@ grub_cryptodisk_read (grub_disk_t disk, grub_disk_addr_t sector,
|
||||
size, sector, dev->offset);
|
||||
|
||||
err = grub_disk_read (dev->source_disk,
|
||||
- (sector << (disk->log_sector_size
|
||||
- - GRUB_DISK_SECTOR_BITS)) + dev->offset, 0,
|
||||
- size << disk->log_sector_size, buf);
|
||||
+ grub_disk_from_native_sector (disk, sector + dev->offset),
|
||||
+ 0, size << disk->log_sector_size, buf);
|
||||
if (err)
|
||||
{
|
||||
grub_dprintf ("cryptodisk", "grub_disk_read failed with error %d\n", err);
|
||||
@@ -656,12 +655,10 @@ grub_cryptodisk_write (grub_disk_t disk, grub_disk_addr_t sector,
|
||||
}
|
||||
|
||||
/* Since ->write was called so disk.mod is loaded but be paranoid */
|
||||
-
|
||||
+ sector = sector + dev->offset;
|
||||
if (grub_disk_write_weak)
|
||||
err = grub_disk_write_weak (dev->source_disk,
|
||||
- (sector << (disk->log_sector_size
|
||||
- - GRUB_DISK_SECTOR_BITS))
|
||||
- + dev->offset,
|
||||
+ grub_disk_from_native_sector (disk, sector),
|
||||
0, size << disk->log_sector_size, tmp);
|
||||
else
|
||||
err = grub_error (GRUB_ERR_BUG, "disk.mod not loaded");
|
||||
diff --git a/include/grub/disk.h b/include/grub/disk.h
|
||||
index 4d3c2e571ef8..0091fbca181c 100644
|
||||
--- a/include/grub/disk.h
|
||||
+++ b/include/grub/disk.h
|
||||
@@ -180,6 +180,13 @@ grub_disk_to_native_sector (grub_disk_t disk, grub_disk_addr_t sector)
|
||||
return sector >> (disk->log_sector_size - GRUB_DISK_SECTOR_BITS);
|
||||
}
|
||||
|
||||
+/* Convert to GRUB native disk sized sector from disk sized sector. */
|
||||
+static inline grub_disk_addr_t
|
||||
+grub_disk_from_native_sector (grub_disk_t disk, grub_disk_addr_t sector)
|
||||
+{
|
||||
+ return sector << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS);
|
||||
+}
|
||||
+
|
||||
/* This is called from the memory manager. */
|
||||
void grub_disk_cache_invalidate_all (void);
|
||||
|
||||
@ -675,3 +675,7 @@ Patch0675: 0675-fs-xfs-Handle-non-continuous-data-blocks-in-director.patch
|
||||
Patch0676: 0676-fs-xfs-fix-large-extent-counters-incompat-feature-su.patch
|
||||
Patch0677: 0677-fs-ext2-Rework-out-of-bounds-read-for-inline-and-ext.patch
|
||||
Patch0678: 0678-Strip-correctly-BLS-files-with-conf-extension.patch
|
||||
Patch0679: 0679-disk-Rename-grub_disk_get_size-to-grub_disk_native_s.patch
|
||||
Patch0680: 0680-fs-Fix-block-lists-not-being-able-to-address-to-end-.patch
|
||||
Patch0681: 0681-osdep-linux-hostdisk-Modify-sector-by-sysfs-as-disk-.patch
|
||||
Patch0682: 0682-cryptodisk-Fix-incorrect-calculation-of-start-sector.patch
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
Name: grub2
|
||||
Epoch: 1
|
||||
Version: 2.02
|
||||
Release: 169%{?dist}
|
||||
Release: 170%{?dist}
|
||||
Summary: Bootloader with support for Linux, Multiboot and more
|
||||
Group: System Environment/Base
|
||||
License: GPLv3+
|
||||
@ -526,6 +526,10 @@ fi
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Thu Jan 22 2026 Nicolas Frayer <nfrayer@redhat.com> - 2.02-170
|
||||
- fs/xfs/ppc64le: Update xfs code to fix install on 4KB block size
|
||||
- Resolves: #RHEL-142208
|
||||
|
||||
* Wed Sep 10 2025 Leo Sandoval <lsandova@redhat.com> - 2.02-169
|
||||
- Run mkconfig when GRUB_ENABLE_BLSCFG is false
|
||||
- Resolves: #RHEL-113830
|
||||
|
||||
Loading…
Reference in New Issue
Block a user