fs/xfs: Sync with latest xfs upstream
Resolves: #RHEL-85960 Signed-off-by: Nicolas Frayer <nfrayer@redhat.com>
This commit is contained in:
parent
12da33fad6
commit
6b93e67189
1684
0458-fs-Remove-trailing-whitespaces.patch
Normal file
1684
0458-fs-Remove-trailing-whitespaces.patch
Normal file
File diff suppressed because it is too large
Load Diff
50
0459-fs-xfs-Fix-memory-leaks-in-XFS-module.patch
Normal file
50
0459-fs-xfs-Fix-memory-leaks-in-XFS-module.patch
Normal file
@ -0,0 +1,50 @@
|
||||
From 1ff9d36ec874d5702be3815e74a71db7764c56ee Mon Sep 17 00:00:00 2001
|
||||
From: "t.feng" <fengtao40@huawei.com>
|
||||
Date: Tue, 29 Nov 2022 17:14:15 +0800
|
||||
Subject: [PATCH 459/464] fs/xfs: Fix memory leaks in XFS module
|
||||
|
||||
Signed-off-by: t.feng <fengtao40@huawei.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
---
|
||||
grub-core/fs/xfs.c | 11 +++++++++--
|
||||
1 file changed, 9 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c
|
||||
index 17bf01f31ddb..8cf41d07c2ee 100644
|
||||
--- a/grub-core/fs/xfs.c
|
||||
+++ b/grub-core/fs/xfs.c
|
||||
@@ -599,7 +599,10 @@ grub_xfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
|
||||
if (grub_disk_read (node->data->disk,
|
||||
GRUB_XFS_FSB_TO_BLOCK (node->data, get_fsb (keys, i - 1 + recoffset)) << (node->data->sblock.log2_bsize - GRUB_DISK_SECTOR_BITS),
|
||||
0, node->data->bsize, leaf))
|
||||
- return 0;
|
||||
+ {
|
||||
+ grub_free (leaf);
|
||||
+ return 0;
|
||||
+ }
|
||||
|
||||
if ((!node->data->hascrc &&
|
||||
grub_strncmp ((char *) leaf->magic, "BMAP", 4)) ||
|
||||
@@ -790,6 +793,7 @@ static int iterate_dir_call_hook (grub_uint64_t ino, const char *filename,
|
||||
if (err)
|
||||
{
|
||||
grub_print_error ();
|
||||
+ grub_free (fdiro);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -907,7 +911,10 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
|
||||
blk << dirblk_log2,
|
||||
dirblk_size, dirblock, 0);
|
||||
if (numread != dirblk_size)
|
||||
- return 0;
|
||||
+ {
|
||||
+ grub_free (dirblock);
|
||||
+ return 0;
|
||||
+ }
|
||||
|
||||
entries = (grub_be_to_cpu32 (tail->leaf_count)
|
||||
- grub_be_to_cpu32 (tail->leaf_stale));
|
||||
--
|
||||
2.46.1
|
||||
|
@ -0,0 +1,51 @@
|
||||
From 270099a784d7dc0d251a8be1fed57e55f4dd4f8f Mon Sep 17 00:00:00 2001
|
||||
From: Lidong Chen <lidong.chen@oracle.com>
|
||||
Date: Thu, 28 Sep 2023 22:33:44 +0000
|
||||
Subject: [PATCH 460/464] fs/xfs: Incorrect short form directory data boundary
|
||||
check
|
||||
|
||||
After parsing of the current entry, the entry pointer is advanced
|
||||
to the next entry at the end of the "for" loop. In case where the
|
||||
last entry is at the end of the data boundary, the advanced entry
|
||||
pointer can point off the data boundary. The subsequent boundary
|
||||
check for the advanced entry pointer can cause a failure.
|
||||
|
||||
The fix is to include the boundary check into the "for" loop
|
||||
condition.
|
||||
|
||||
Signed-off-by: Lidong Chen <lidong.chen@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Tested-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
|
||||
Tested-by: Marta Lewandowska <mlewando@redhat.com>
|
||||
---
|
||||
grub-core/fs/xfs.c | 7 ++-----
|
||||
1 file changed, 2 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c
|
||||
index 8cf41d07c2ee..a779eb6b8334 100644
|
||||
--- a/grub-core/fs/xfs.c
|
||||
+++ b/grub-core/fs/xfs.c
|
||||
@@ -836,7 +836,8 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
|
||||
if (iterate_dir_call_hook (parent, "..", &ctx))
|
||||
return 1;
|
||||
|
||||
- for (i = 0; i < head->count; i++)
|
||||
+ for (i = 0; i < head->count &&
|
||||
+ (grub_uint8_t *) de < ((grub_uint8_t *) dir + grub_xfs_fshelp_size (dir->data)); i++)
|
||||
{
|
||||
grub_uint64_t ino;
|
||||
grub_uint8_t *inopos = grub_xfs_inline_de_inopos(dir->data, de);
|
||||
@@ -871,10 +872,6 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
|
||||
de->name[de->len] = c;
|
||||
|
||||
de = grub_xfs_inline_next_de(dir->data, head, de);
|
||||
-
|
||||
- if ((grub_uint8_t *) de >= (grub_uint8_t *) dir + grub_xfs_fshelp_size (dir->data))
|
||||
- return grub_error (GRUB_ERR_BAD_FS, "invalid XFS directory entry");
|
||||
-
|
||||
}
|
||||
break;
|
||||
}
|
||||
--
|
||||
2.46.1
|
||||
|
171
0461-fs-xfs-Fix-XFS-directory-extent-parsing.patch
Normal file
171
0461-fs-xfs-Fix-XFS-directory-extent-parsing.patch
Normal file
@ -0,0 +1,171 @@
|
||||
From e5d18ae1b2b0ff58ce720dad90b3539aa2f28ee1 Mon Sep 17 00:00:00 2001
|
||||
From: Jon DeVree <nuxi@vault24.org>
|
||||
Date: Tue, 17 Oct 2023 23:03:47 -0400
|
||||
Subject: [PATCH 461/464] fs/xfs: Fix XFS directory extent parsing
|
||||
|
||||
The XFS directory entry parsing code has never been completely correct
|
||||
for extent based directories. The parser correctly handles the case
|
||||
where the directory is contained in a single extent, but then mistakenly
|
||||
assumes the data blocks for the multiple extent case are each identical
|
||||
to the single extent case. The difference in the format of the data
|
||||
blocks between the two cases is tiny enough that its gone unnoticed for
|
||||
a very long time.
|
||||
|
||||
A recent change introduced some additional bounds checking into the XFS
|
||||
parser. Like GRUB's existing parser, it is correct for the single extent
|
||||
case but incorrect for the multiple extent case. When parsing a directory
|
||||
with multiple extents, this new bounds checking is sometimes (but not
|
||||
always) tripped and triggers an "invalid XFS directory entry" error. This
|
||||
probably would have continued to go unnoticed but the /boot/grub/<arch>
|
||||
directory is large enough that it often has multiple extents.
|
||||
|
||||
The difference between the two cases is that when there are multiple
|
||||
extents, the data blocks do not contain a trailer nor do they contain
|
||||
any leaf information. That information is stored in a separate set of
|
||||
extents dedicated to just the leaf information. These extents come after
|
||||
the directory entry extents and are not included in the inode size. So
|
||||
the existing parser already ignores the leaf extents.
|
||||
|
||||
The only reason to read the trailer/leaf information at all is so that
|
||||
the parser can avoid misinterpreting that data as directory entries. So
|
||||
this updates the parser as follows:
|
||||
|
||||
For the single extent case the parser doesn't change much:
|
||||
1. Read the size of the leaf information from the trailer
|
||||
2. Set the end pointer for the parser to the start of the leaf
|
||||
information. (The previous bounds checking set the end pointer to the
|
||||
start of the trailer, so this is actually a small improvement.)
|
||||
3. Set the entries variable to the expected number of directory entries.
|
||||
|
||||
For the multiple extent case:
|
||||
1. Set the end pointer to the end of the block.
|
||||
2. Do not set up the entries variable. Figuring out how many entries are
|
||||
in each individual block is complex and does not seem worth it when
|
||||
it appears to be safe to just iterate over the entire block.
|
||||
|
||||
The bounds check itself was also dependent upon the faulty XFS parser
|
||||
because it accidentally used "filename + length - 1". Presumably this
|
||||
was able to pass the fuzzer because in the old parser there was always
|
||||
8 bytes of slack space between the tail pointer and the actual end of
|
||||
the block. Since this is no longer the case the bounds check needs to be
|
||||
updated to "filename + length + 1" in order to prevent a regression in
|
||||
the handling of corrupt fliesystems.
|
||||
|
||||
Notes:
|
||||
* When there is only one extent there will only ever be one block. If
|
||||
more than one block is required then XFS will always switch to holding
|
||||
leaf information in a separate extent.
|
||||
* B-tree based directories seems to be parsed properly by the same code
|
||||
that handles multiple extents. This is unlikely to ever occur within
|
||||
/boot though because its only used when there are an extremely large
|
||||
number of directory entries.
|
||||
|
||||
Fixes: ef7850c75 (fs/xfs: Fix issues found while fuzzing the XFS filesystem)
|
||||
Fixes: b2499b29c (Adds support for the XFS filesystem.)
|
||||
Fixes: https://savannah.gnu.org/bugs/?64376
|
||||
|
||||
Signed-off-by: Jon DeVree <nuxi@vault24.org>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Tested-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
|
||||
Tested-by: Marta Lewandowska <mlewando@redhat.com>
|
||||
---
|
||||
grub-core/fs/xfs.c | 52 +++++++++++++++++++++++++++++++++-------------
|
||||
1 file changed, 38 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c
|
||||
index a779eb6b8334..e178ffcdc290 100644
|
||||
--- a/grub-core/fs/xfs.c
|
||||
+++ b/grub-core/fs/xfs.c
|
||||
@@ -223,6 +223,12 @@ struct grub_xfs_inode
|
||||
/* Size of struct grub_xfs_inode v2, up to unused4 member included. */
|
||||
#define XFS_V2_INODE_SIZE (XFS_V3_INODE_SIZE - 76)
|
||||
|
||||
+struct grub_xfs_dir_leaf_entry
|
||||
+{
|
||||
+ grub_uint32_t hashval;
|
||||
+ grub_uint32_t address;
|
||||
+} GRUB_PACKED;
|
||||
+
|
||||
struct grub_xfs_dirblock_tail
|
||||
{
|
||||
grub_uint32_t leaf_count;
|
||||
@@ -900,9 +906,8 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
|
||||
{
|
||||
struct grub_xfs_dir2_entry *direntry =
|
||||
grub_xfs_first_de(dir->data, dirblock);
|
||||
- int entries;
|
||||
- struct grub_xfs_dirblock_tail *tail =
|
||||
- grub_xfs_dir_tail(dir->data, dirblock);
|
||||
+ int entries = -1;
|
||||
+ char *end = dirblock + dirblk_size;
|
||||
|
||||
numread = grub_xfs_read_file (dir, 0, 0,
|
||||
blk << dirblk_log2,
|
||||
@@ -913,14 +918,27 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
|
||||
return 0;
|
||||
}
|
||||
|
||||
- entries = (grub_be_to_cpu32 (tail->leaf_count)
|
||||
- - grub_be_to_cpu32 (tail->leaf_stale));
|
||||
+ /*
|
||||
+ * Leaf and tail information are only in the data block if the number
|
||||
+ * of extents is 1.
|
||||
+ */
|
||||
+ if (dir->inode.nextents == grub_cpu_to_be32_compile_time (1))
|
||||
+ {
|
||||
+ struct grub_xfs_dirblock_tail *tail = grub_xfs_dir_tail (dir->data, dirblock);
|
||||
+
|
||||
+ end = (char *) tail;
|
||||
+
|
||||
+ /* Subtract the space used by leaf nodes. */
|
||||
+ end -= grub_be_to_cpu32 (tail->leaf_count) * sizeof (struct grub_xfs_dir_leaf_entry);
|
||||
|
||||
- if (!entries)
|
||||
- continue;
|
||||
+ entries = grub_be_to_cpu32 (tail->leaf_count) - grub_be_to_cpu32 (tail->leaf_stale);
|
||||
+
|
||||
+ if (!entries)
|
||||
+ continue;
|
||||
+ }
|
||||
|
||||
/* Iterate over all entries within this block. */
|
||||
- while ((char *)direntry < (char *)tail)
|
||||
+ while ((char *) direntry < (char *) end)
|
||||
{
|
||||
grub_uint8_t *freetag;
|
||||
char *filename;
|
||||
@@ -940,7 +958,7 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
|
||||
}
|
||||
|
||||
filename = (char *)(direntry + 1);
|
||||
- if (filename + direntry->len - 1 > (char *) tail)
|
||||
+ if (filename + direntry->len + 1 > (char *) end)
|
||||
return grub_error (GRUB_ERR_BAD_FS, "invalid XFS directory entry");
|
||||
|
||||
/* The byte after the filename is for the filetype, padding, or
|
||||
@@ -954,11 +972,17 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
|
||||
return 1;
|
||||
}
|
||||
|
||||
- /* Check if last direntry in this block is
|
||||
- reached. */
|
||||
- entries--;
|
||||
- if (!entries)
|
||||
- break;
|
||||
+ /*
|
||||
+ * The expected number of directory entries is only tracked for the
|
||||
+ * single extent case.
|
||||
+ */
|
||||
+ if (dir->inode.nextents == grub_cpu_to_be32_compile_time (1))
|
||||
+ {
|
||||
+ /* Check if last direntry in this block is reached. */
|
||||
+ entries--;
|
||||
+ if (!entries)
|
||||
+ break;
|
||||
+ }
|
||||
|
||||
/* Select the next directory entry. */
|
||||
direntry = grub_xfs_next_de(dir->data, direntry);
|
||||
--
|
||||
2.46.1
|
||||
|
119
0462-fs-xfs-Add-large-extent-counters-incompat-feature-su.patch
Normal file
119
0462-fs-xfs-Add-large-extent-counters-incompat-feature-su.patch
Normal file
@ -0,0 +1,119 @@
|
||||
From 16ff7f17e65503ed53758ccc0245c1fabd444fb2 Mon Sep 17 00:00:00 2001
|
||||
From: Anthony Iliopoulos <ailiop@suse.com>
|
||||
Date: Thu, 26 Oct 2023 11:53:39 +0200
|
||||
Subject: [PATCH 462/464] fs/xfs: Add large extent counters incompat feature
|
||||
support
|
||||
|
||||
XFS introduced 64-bit extent counters for inodes via a series of
|
||||
upstream commits and the feature was marked as stable in v6.5 via
|
||||
commit 61d7e8274cd8 (xfs: drop EXPERIMENTAL tag for large extent
|
||||
counts).
|
||||
|
||||
Further, xfsprogs release v6.5.0 switched this feature on by default
|
||||
in mkfs.xfs via commit e5b18d7d1d96 (mkfs: enable large extent counts
|
||||
by default).
|
||||
|
||||
Filesystems formatted with large extent count support, nrext64=1, are
|
||||
thus currently not recognizable by GRUB, since this is an incompat
|
||||
feature. Add the required support so that those filesystems and inodes
|
||||
with large extent counters can be read by GRUB.
|
||||
|
||||
Signed-off-by: Anthony Iliopoulos <ailiop@suse.com>
|
||||
Reviewed-by: Andrey Albershteyn <aalbersh@redhat.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Tested-by: Marta Lewandowska <mlewando@redhat.com>
|
||||
Tested-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
|
||||
---
|
||||
grub-core/fs/xfs.c | 30 +++++++++++++++++++++++++-----
|
||||
1 file changed, 25 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c
|
||||
index e178ffcdc290..70c9f449b133 100644
|
||||
--- a/grub-core/fs/xfs.c
|
||||
+++ b/grub-core/fs/xfs.c
|
||||
@@ -79,6 +79,8 @@ GRUB_MOD_LICENSE ("GPLv3+");
|
||||
/* Inode flags2 flags */
|
||||
#define XFS_DIFLAG2_BIGTIME_BIT 3
|
||||
#define XFS_DIFLAG2_BIGTIME (1 << XFS_DIFLAG2_BIGTIME_BIT)
|
||||
+#define XFS_DIFLAG2_NREXT64_BIT 4
|
||||
+#define XFS_DIFLAG2_NREXT64 (1 << XFS_DIFLAG2_NREXT64_BIT)
|
||||
|
||||
/* incompat feature flags */
|
||||
#define XFS_SB_FEAT_INCOMPAT_FTYPE (1 << 0) /* filetype in dirent */
|
||||
@@ -86,6 +88,7 @@ GRUB_MOD_LICENSE ("GPLv3+");
|
||||
#define XFS_SB_FEAT_INCOMPAT_META_UUID (1 << 2) /* metadata UUID */
|
||||
#define XFS_SB_FEAT_INCOMPAT_BIGTIME (1 << 3) /* large timestamps */
|
||||
#define XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR (1 << 4) /* needs xfs_repair */
|
||||
+#define XFS_SB_FEAT_INCOMPAT_NREXT64 (1 << 5) /* large extent counters */
|
||||
|
||||
/*
|
||||
* Directory entries with ftype are explicitly handled by GRUB code.
|
||||
@@ -101,7 +104,8 @@ GRUB_MOD_LICENSE ("GPLv3+");
|
||||
XFS_SB_FEAT_INCOMPAT_SPINODES | \
|
||||
XFS_SB_FEAT_INCOMPAT_META_UUID | \
|
||||
XFS_SB_FEAT_INCOMPAT_BIGTIME | \
|
||||
- XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR)
|
||||
+ XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR | \
|
||||
+ XFS_SB_FEAT_INCOMPAT_NREXT64)
|
||||
|
||||
struct grub_xfs_sblock
|
||||
{
|
||||
@@ -203,7 +207,8 @@ struct grub_xfs_inode
|
||||
grub_uint16_t mode;
|
||||
grub_uint8_t version;
|
||||
grub_uint8_t format;
|
||||
- grub_uint8_t unused2[26];
|
||||
+ grub_uint8_t unused2[18];
|
||||
+ grub_uint64_t nextents_big;
|
||||
grub_uint64_t atime;
|
||||
grub_uint64_t mtime;
|
||||
grub_uint64_t ctime;
|
||||
@@ -547,11 +552,26 @@ get_fsb (const void *keys, int idx)
|
||||
return grub_be_to_cpu64 (grub_get_unaligned64 (p));
|
||||
}
|
||||
|
||||
+static int
|
||||
+grub_xfs_inode_has_large_extent_counts (const struct grub_xfs_inode *inode)
|
||||
+{
|
||||
+ return inode->version >= 3 &&
|
||||
+ (inode->flags2 & grub_cpu_to_be64_compile_time (XFS_DIFLAG2_NREXT64));
|
||||
+}
|
||||
+
|
||||
+static grub_uint64_t
|
||||
+grub_xfs_get_inode_nextents (struct grub_xfs_inode *inode)
|
||||
+{
|
||||
+ return (grub_xfs_inode_has_large_extent_counts (inode)) ?
|
||||
+ grub_be_to_cpu64 (inode->nextents_big) :
|
||||
+ grub_be_to_cpu32 (inode->nextents);
|
||||
+}
|
||||
+
|
||||
static grub_disk_addr_t
|
||||
grub_xfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
|
||||
{
|
||||
struct grub_xfs_btree_node *leaf = 0;
|
||||
- int ex, nrec;
|
||||
+ grub_uint64_t ex, nrec;
|
||||
struct grub_xfs_extent *exts;
|
||||
grub_uint64_t ret = 0;
|
||||
|
||||
@@ -576,7 +596,7 @@ grub_xfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
|
||||
/ (2 * sizeof (grub_uint64_t));
|
||||
do
|
||||
{
|
||||
- int i;
|
||||
+ grub_uint64_t i;
|
||||
grub_addr_t keys_end, data_end;
|
||||
|
||||
if (grub_mul (sizeof (grub_uint64_t), nrec, &keys_end) ||
|
||||
@@ -634,7 +654,7 @@ grub_xfs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
|
||||
grub_addr_t exts_end = 0;
|
||||
grub_addr_t data_end = 0;
|
||||
|
||||
- nrec = grub_be_to_cpu32 (node->inode.nextents);
|
||||
+ nrec = grub_xfs_get_inode_nextents (&node->inode);
|
||||
exts = (struct grub_xfs_extent *) grub_xfs_inode_data(&node->inode);
|
||||
|
||||
if (grub_mul (sizeof (struct grub_xfs_extent), nrec, &exts_end) ||
|
||||
--
|
||||
2.46.1
|
||||
|
@ -0,0 +1,57 @@
|
||||
From 300b38fdf7036bf3b2f6244456e1adb3f9c1c359 Mon Sep 17 00:00:00 2001
|
||||
From: Jon DeVree <nuxi@vault24.org>
|
||||
Date: Sun, 11 Feb 2024 10:34:58 -0500
|
||||
Subject: [PATCH 463/464] fs/xfs: Handle non-continuous data blocks in
|
||||
directory extents
|
||||
|
||||
The directory extent list does not have to be a continuous list of data
|
||||
blocks. When GRUB tries to read a non-existant member of the list,
|
||||
grub_xfs_read_file() will return a block of zero'ed memory. Checking for
|
||||
a zero'ed magic number is sufficient to skip this non-existant data block.
|
||||
|
||||
Prior to commit 07318ee7e (fs/xfs: Fix XFS directory extent parsing)
|
||||
this was handled as a subtle side effect of reading the (non-existant)
|
||||
tail data structure. Since the block was zero'ed the computation of the
|
||||
number of directory entries in the block would return 0 as well.
|
||||
|
||||
Fixes: 07318ee7e (fs/xfs: Fix XFS directory extent parsing)
|
||||
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2254370
|
||||
|
||||
Signed-off-by: Jon DeVree <nuxi@vault24.org>
|
||||
Reviewed-By: Vladimir Serbinenko <phcoder@gmail.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
---
|
||||
grub-core/fs/xfs.c | 10 ++++++++++
|
||||
1 file changed, 10 insertions(+)
|
||||
|
||||
diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c
|
||||
index 70c9f449b133..ab1281497472 100644
|
||||
--- a/grub-core/fs/xfs.c
|
||||
+++ b/grub-core/fs/xfs.c
|
||||
@@ -928,6 +928,7 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
|
||||
grub_xfs_first_de(dir->data, dirblock);
|
||||
int entries = -1;
|
||||
char *end = dirblock + dirblk_size;
|
||||
+ grub_uint32_t magic;
|
||||
|
||||
numread = grub_xfs_read_file (dir, 0, 0,
|
||||
blk << dirblk_log2,
|
||||
@@ -938,6 +939,15 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
|
||||
return 0;
|
||||
}
|
||||
|
||||
+ /*
|
||||
+ * If this data block isn't actually part of the extent list then
|
||||
+ * grub_xfs_read_file() returns a block of zeros. So, if the magic
|
||||
+ * number field is all zeros then this block should be skipped.
|
||||
+ */
|
||||
+ magic = *(grub_uint32_t *)(void *) dirblock;
|
||||
+ if (!magic)
|
||||
+ continue;
|
||||
+
|
||||
/*
|
||||
* Leaf and tail information are only in the data block if the number
|
||||
* of extents is 1.
|
||||
--
|
||||
2.46.1
|
||||
|
@ -0,0 +1,48 @@
|
||||
From 6c6b8bebde2261aac2fbe7abd6d03008a5e06ce9 Mon Sep 17 00:00:00 2001
|
||||
From: Eric Sandeen <sandeen@redhat.com>
|
||||
Date: Wed, 4 Dec 2024 07:50:28 -0600
|
||||
Subject: [PATCH 464/464] fs/xfs: fix large extent counters incompat feature
|
||||
support
|
||||
|
||||
When large extent counter / NREXT64 support was added to grub, it missed
|
||||
a couple of direct reads of nextents which need to be changed to the new
|
||||
NREXT64-aware helper as well. Without this, we'll have mis-reads of some
|
||||
directories with this feature enabled.
|
||||
|
||||
(The large extent counter fix likely raced on merge with
|
||||
07318ee7e ("fs/xfs: Fix XFS directory extent parsing") which added the new
|
||||
direct nextents reads just prior, causing this issue.)
|
||||
|
||||
Fixes: aa7c1322671e ("fs/xfs: Add large extent counters incompat feature support")
|
||||
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
|
||||
Reviewed-by: Anthony Iliopoulos <ailiop@suse.com>
|
||||
Reviewed-by: Jon DeVree <nuxi@vault24.org>
|
||||
---
|
||||
grub-core/fs/xfs.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c
|
||||
index ab1281497472..c60db73613c5 100644
|
||||
--- a/grub-core/fs/xfs.c
|
||||
+++ b/grub-core/fs/xfs.c
|
||||
@@ -952,7 +952,7 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
|
||||
* Leaf and tail information are only in the data block if the number
|
||||
* of extents is 1.
|
||||
*/
|
||||
- if (dir->inode.nextents == grub_cpu_to_be32_compile_time (1))
|
||||
+ if (grub_xfs_get_inode_nextents(&dir->inode) == 1)
|
||||
{
|
||||
struct grub_xfs_dirblock_tail *tail = grub_xfs_dir_tail (dir->data, dirblock);
|
||||
|
||||
@@ -1006,7 +1006,7 @@ grub_xfs_iterate_dir (grub_fshelp_node_t dir,
|
||||
* The expected number of directory entries is only tracked for the
|
||||
* single extent case.
|
||||
*/
|
||||
- if (dir->inode.nextents == grub_cpu_to_be32_compile_time (1))
|
||||
+ if (grub_xfs_get_inode_nextents(&dir->inode) == 1)
|
||||
{
|
||||
/* Check if last direntry in this block is reached. */
|
||||
entries--;
|
||||
--
|
||||
2.46.1
|
||||
|
@ -454,3 +454,10 @@ Patch0454: 0454-fs-ext2-Rework-out-of-bounds-read-for-inline-and-ext.patch
|
||||
Patch0455: 0455-tpm-Disable-the-tpm-verifier-if-the-TPM-device-is-no.patch
|
||||
Patch0456: 0456-powerpc-increase-MIN-RMA-size-for-CAS-negotiation.patch
|
||||
Patch0457: 0457-ieee1275-ofnet-Fix-grub_malloc-removed-after-added-s.patch
|
||||
Patch0458: 0458-fs-Remove-trailing-whitespaces.patch
|
||||
Patch0459: 0459-fs-xfs-Fix-memory-leaks-in-XFS-module.patch
|
||||
Patch0460: 0460-fs-xfs-Incorrect-short-form-directory-data-boundary-.patch
|
||||
Patch0461: 0461-fs-xfs-Fix-XFS-directory-extent-parsing.patch
|
||||
Patch0462: 0462-fs-xfs-Add-large-extent-counters-incompat-feature-su.patch
|
||||
Patch0463: 0463-fs-xfs-Handle-non-continuous-data-blocks-in-director.patch
|
||||
Patch0464: 0464-fs-xfs-fix-large-extent-counters-incompat-feature-su.patch
|
||||
|
@ -16,7 +16,7 @@
|
||||
Name: grub2
|
||||
Epoch: 1
|
||||
Version: 2.06
|
||||
Release: 100%{?dist}
|
||||
Release: 104%{?dist}
|
||||
Summary: Bootloader with support for Linux, Multiboot and more
|
||||
License: GPLv3+
|
||||
URL: http://www.gnu.org/software/grub/
|
||||
@ -547,6 +547,11 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Thu Apr 3 2025 Nicolas Frayer <nfrayer@redhat.com> 2.06-104
|
||||
- fs/xfs: Sync with latest xfs upstream
|
||||
- Resolves: #RHEL-85960
|
||||
- (NVR bump to catch up with zstream)
|
||||
|
||||
* Tue Mar 25 2025 Nicolas Frayer <nfrayer@redhat.com> 2.06-100
|
||||
- ieee1275/ofnet: Fix grub_malloc() removed after added safe
|
||||
- Resolves: #RHEL-83117
|
||||
|
Loading…
Reference in New Issue
Block a user