Skip to content

Commit

Permalink
Backport fix for handling newer ext fs versions
Browse files Browse the repository at this point in the history
mkfs in F41 enables metadata_csum feature, make grub tolerate it.

QubesOS/qubes-issues#9402
  • Loading branch information
marmarek committed Aug 12, 2024
1 parent 0ca8d34 commit 26e8aac
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
54 changes: 54 additions & 0 deletions 0179-fs-ext2-Ignore-checksum-seed-incompat-feature.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <[email protected]>
Date: Fri, 11 Jun 2021 00:01:29 +0200
Subject: [PATCH] fs/ext2: Ignore checksum seed incompat feature

This incompat feature is used to denote that the filesystem stored its
metadata checksum seed in the superblock. This is used to allow tune2fs
to change the UUID on a mounted metadata_csum filesystem without having
to rewrite all the disk metadata.

But GRUB doesn't use the metadata checksum in anyway, so can just ignore
this feature if is enabled. This is consistent with GRUB filesystem code
in general which just does a best effort to access the filesystem's data.

It may be removed from the ignored list in the future if supports to do
metadata checksumming verification is added to the read-only FS driver.

Suggested-by: Eric Sandeen <[email protected]>
Suggested-by: Lukas Czerner <[email protected]>
Signed-off-by: Javier Martinez Canillas <[email protected]>
---
grub-core/fs/ext2.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/grub-core/fs/ext2.c b/grub-core/fs/ext2.c
index e7dd78e663..731d346f88 100644
--- a/grub-core/fs/ext2.c
+++ b/grub-core/fs/ext2.c
@@ -103,6 +103,7 @@ GRUB_MOD_LICENSE ("GPLv3+");
#define EXT4_FEATURE_INCOMPAT_64BIT 0x0080
#define EXT4_FEATURE_INCOMPAT_MMP 0x0100
#define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200
+#define EXT4_FEATURE_INCOMPAT_CSUM_SEED 0x2000
#define EXT4_FEATURE_INCOMPAT_ENCRYPT 0x10000

/* The set of back-incompatible features this driver DOES support. Add (OR)
@@ -123,9 +124,16 @@ GRUB_MOD_LICENSE ("GPLv3+");
* mmp: Not really back-incompatible - was added as such to
* avoid multiple read-write mounts. Safe to ignore for this
* RO driver.
+ * checksum seed: Not really back-incompatible - was added to allow tools
+ * such as tune2fs to change the UUID on a mounted metadata
+ * checksummed filesystem. Safe to ignore for now since the
+ * driver doesn't support checksum verification. But it must
+ * be removed from this list if that support is added later.
+ *
*/
#define EXT2_DRIVER_IGNORED_INCOMPAT ( EXT3_FEATURE_INCOMPAT_RECOVER \
- | EXT4_FEATURE_INCOMPAT_MMP)
+ | EXT4_FEATURE_INCOMPAT_MMP \
+ | EXT4_FEATURE_INCOMPAT_CSUM_SEED)


#define EXT3_JOURNAL_MAGIC_NUMBER 0xc03b3998U
1 change: 1 addition & 0 deletions grub2.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,7 @@ Patch0144: 0144-grub-install-disable-support-for-EFI-platforms.patch
Patch0147: 0147-Introduce-function-grub_debug_is_enabled-void-return.patch
Patch0148: 0148-Don-t-clear-screen-when-debugging-is-enabled.patch
Patch0154: 0154-Add-at_keyboard_fallback_set-var-to-force-the-set-ma.patch
Patch0179: 0179-fs-ext2-Ignore-checksum-seed-incompat-feature.patch
Patch0181: 0181-Suppress-gettext-error-message.patch
Patch0183: 0183-templates-Check-for-EFI-at-runtime-instead-of-config.patch
Patch0184: 0184-efi-Print-an-error-if-boot-to-firmware-setup-is-not-.patch
Expand Down

0 comments on commit 26e8aac

Please sign in to comment.