summaryrefslogtreecommitdiff
path: root/source/a
diff options
context:
space:
mode:
authorPatrick J Volkerding <volkerdi@slackware.com>2021-09-09 18:51:50 +0000
committerEric Hameleers <alien@slackware.com>2021-09-10 09:03:35 +0200
commit322eeb760b467e9e0862765a8112d3c5c6fb16b2 (patch)
tree92514229a9b6fbaf86e82619054d2c0e7b7ccd8b /source/a
parentcada39317fcfe1000587376592683296bacba210 (diff)
downloadcurrent-322eeb760b467e9e0862765a8112d3c5c6fb16b2.tar.gz
Thu Sep 9 18:51:50 UTC 202120210909185150
a/grub-2.06-x86_64-3.txz: Rebuilt. Fix unreadable XFS filesystem with v4 superblock. Thanks to Didier Spaier. d/python-setuptools-58.0.4-x86_64-1.txz: Upgraded. d/rust-1.55.0-x86_64-1.txz: Upgraded. l/gst-plugins-base-1.18.5-x86_64-1.txz: Upgraded. l/gst-plugins-good-1.18.5-x86_64-1.txz: Upgraded. l/gst-plugins-libav-1.18.5-x86_64-1.txz: Upgraded. l/gstreamer-1.18.5-x86_64-1.txz: Upgraded. l/libgtop-2.40.0-x86_64-5.txz: Rebuilt. Don't ship .la files. Thanks to Toutatis. l/pipewire-0.3.35-x86_64-1.txz: Upgraded. n/dnsmasq-2.86-x86_64-1.txz: Upgraded. xfce/mousepad-0.5.6-x86_64-2.txz: Rebuilt. Don't ship .la files. Thanks to Toutatis.
Diffstat (limited to 'source/a')
-rw-r--r--source/a/grub/a4b495520e4dc41a896a8b916a64eda9970c50ea.patch121
-rwxr-xr-xsource/a/grub/grub.SlackBuild5
2 files changed, 125 insertions, 1 deletions
diff --git a/source/a/grub/a4b495520e4dc41a896a8b916a64eda9970c50ea.patch b/source/a/grub/a4b495520e4dc41a896a8b916a64eda9970c50ea.patch
new file mode 100644
index 00000000..5abc747a
--- /dev/null
+++ b/source/a/grub/a4b495520e4dc41a896a8b916a64eda9970c50ea.patch
@@ -0,0 +1,121 @@
+From a4b495520e4dc41a896a8b916a64eda9970c50ea Mon Sep 17 00:00:00 2001
+From: Erwan Velu <erwanaliasr1@gmail.com>
+Date: Wed, 25 Aug 2021 15:31:52 +0200
+Subject: fs/xfs: Fix unreadable filesystem with v4 superblock
+
+The commit 8b1e5d193 (fs/xfs: Add bigtime incompat feature support)
+introduced the bigtime support by adding some features in v3 inodes.
+This change extended grub_xfs_inode struct by 76 bytes but also changed
+the computation of XFS_V2_INODE_SIZE and XFS_V3_INODE_SIZE. Prior this
+commit, XFS_V2_INODE_SIZE was 100 bytes. After the commit it's 84 bytes
+XFS_V2_INODE_SIZE becomes 16 bytes too small.
+
+As a result, the data structures aren't properly aligned and the GRUB
+generates "attempt to read or write outside of partition" errors when
+trying to read the XFS filesystem:
+
+ GNU GRUB version 2.11
+ ....
+ grub> set debug=efi,gpt,xfs
+ grub> insmod part_gpt
+ grub> ls (hd0,gpt1)/
+ partmap/gpt.c:93: Read a valid GPT header
+ partmap/gpt.c:115: GPT entry 0: start=4096, length=1953125
+ fs/xfs.c:931: Reading sb
+ fs/xfs.c:270: Validating superblock
+ fs/xfs.c:295: XFS v4 superblock detected
+ fs/xfs.c:962: Reading root ino 128
+ fs/xfs.c:515: Reading inode (128) - 64, 0
+ fs/xfs.c:515: Reading inode (739521961424144223) - 344365866970255880, 3840
+ error: attempt to read or write outside of partition.
+
+This commit change the XFS_V2_INODE_SIZE computation by subtracting 76
+bytes instead of 92 bytes from the actual size of grub_xfs_inode struct.
+This 76 bytes value comes from added members:
+ 20 grub_uint8_t unused5
+ 1 grub_uint64_t flags2
+ 48 grub_uint8_t unused6
+
+This patch explicitly splits the v2 and v3 parts of the structure.
+The unused4 is still ending of the v2 structures and the v3 starts
+at unused5. Thanks to this we will avoid future corruptions of v2
+or v3 inodes.
+
+The XFS_V2_INODE_SIZE is returning to its expected size and the
+filesystem is back to a readable state:
+
+ GNU GRUB version 2.11
+ ....
+ grub> set debug=efi,gpt,xfs
+ grub> insmod part_gpt
+ grub> ls (hd0,gpt1)/
+ partmap/gpt.c:93: Read a valid GPT header
+ partmap/gpt.c:115: GPT entry 0: start=4096, length=1953125
+ fs/xfs.c:931: Reading sb
+ fs/xfs.c:270: Validating superblock
+ fs/xfs.c:295: XFS v4 superblock detected
+ fs/xfs.c:962: Reading root ino 128
+ fs/xfs.c:515: Reading inode (128) - 64, 0
+ fs/xfs.c:515: Reading inode (128) - 64, 0
+ fs/xfs.c:931: Reading sb
+ fs/xfs.c:270: Validating superblock
+ fs/xfs.c:295: XFS v4 superblock detected
+ fs/xfs.c:962: Reading root ino 128
+ fs/xfs.c:515: Reading inode (128) - 64, 0
+ fs/xfs.c:515: Reading inode (128) - 64, 0
+ fs/xfs.c:515: Reading inode (128) - 64, 0
+ fs/xfs.c:515: Reading inode (131) - 64, 768
+ efi/ fs/xfs.c:515: Reading inode (3145856) - 1464904, 0
+ grub2/ fs/xfs.c:515: Reading inode (132) - 64, 1024
+ grub/ fs/xfs.c:515: Reading inode (139) - 64, 2816
+ grub>
+
+Fixes: 8b1e5d193 (fs/xfs: Add bigtime incompat feature support)
+
+Signed-off-by: Erwan Velu <e.velu@criteo.com>
+Tested-by: Carlos Maiolino <cmaiolino@redhat.com>
+Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
+---
+ grub-core/fs/xfs.c | 14 ++++++++++----
+ 1 file changed, 10 insertions(+), 4 deletions(-)
+
+diff --git a/grub-core/fs/xfs.c b/grub-core/fs/xfs.c
+index 0f524c3a8..e3816d1ec 100644
+--- a/grub-core/fs/xfs.c
++++ b/grub-core/fs/xfs.c
+@@ -192,6 +192,11 @@ struct grub_xfs_time_legacy
+ grub_uint32_t nanosec;
+ } GRUB_PACKED;
+
++/*
++ * The struct grub_xfs_inode layout was taken from the
++ * struct xfs_dinode_core which is described here:
++ * https://mirrors.edge.kernel.org/pub/linux/utils/fs/xfs/docs/xfs_filesystem_structure.pdf
++ */
+ struct grub_xfs_inode
+ {
+ grub_uint8_t magic[2];
+@@ -208,14 +213,15 @@ struct grub_xfs_inode
+ grub_uint32_t nextents;
+ grub_uint16_t unused3;
+ grub_uint8_t fork_offset;
+- grub_uint8_t unused4[37];
++ grub_uint8_t unused4[17]; /* Last member of inode v2. */
++ grub_uint8_t unused5[20]; /* First member of inode v3. */
+ grub_uint64_t flags2;
+- grub_uint8_t unused5[48];
++ grub_uint8_t unused6[48]; /* Last member of inode v3. */
+ } GRUB_PACKED;
+
+ #define XFS_V3_INODE_SIZE sizeof(struct grub_xfs_inode)
+-/* Size of struct grub_xfs_inode until fork_offset (included). */
+-#define XFS_V2_INODE_SIZE (XFS_V3_INODE_SIZE - 92)
++/* 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_dirblock_tail
+ {
+--
+cgit v1.2.1
+
+
diff --git a/source/a/grub/grub.SlackBuild b/source/a/grub/grub.SlackBuild
index cda4f57d..7cf8b5b2 100755
--- a/source/a/grub/grub.SlackBuild
+++ b/source/a/grub/grub.SlackBuild
@@ -28,7 +28,7 @@ PKGNAM=grub
VERSION=${VERSION:-$(echo $PKGNAM-*.tar.xz | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
# Better to use _ than ~ in the package filenames version:
PKGVER=$(echo $VERSION | tr '~' '_')
-BUILD=${BUILD:-2}
+BUILD=${BUILD:-3}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
@@ -112,6 +112,9 @@ zcat $CWD/grub.dejavusansmono.gfxterm.font.diff.gz | patch -p1 --verbose || exit
# Fix alignment error with gcc8:
zcat $CWD/0198-align-struct-efi_variable-better.patch.gz | patch -p1 --verbose || exit 1
+# Fix unreadable XFS filesystem with v4 superblock:
+zcat $CWD/a4b495520e4dc41a896a8b916a64eda9970c50ea.patch.gz | patch -p1 --verbose || exit 1
+
# Regenerate build system to fix dependency on outdated automake:
autoreconf -vif