lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 24 Feb 2018 20:33:25 -0500
From:   Theodore Ts'o <tytso@....edu>
To:     Ext4 Developers List <linux-ext4@...r.kernel.org>
Cc:     neilb@...e.com, Theodore Ts'o <tytso@....edu>
Subject: [PATCH 3/3] tune2fs: if turning off csum_seed and the UUID has changed, require fsck

In the case where the UUID has changed and the user wants to turn off
the csum_seed feature, it's important that file system be freshly
checked.  That's also the only case when it's necessary to recalculate
all of the metadata file systems.

Signed-off-by: Theodore Ts'o <tytso@....edu>
---
 misc/tune2fs.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index 9c8b6e43d..b11b2e3f3 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -1366,16 +1366,18 @@ mmp_error:
 
 		uuid_seed = ext2fs_crc32c_le(~0, fs->super->s_uuid,
 					sizeof(fs->super->s_uuid));
-		if (fs->super->s_checksum_seed != uuid_seed &&
-		    (mount_flags & EXT2_MF_MOUNTED)) {
-			fputs(_("UUID has changed since enabling "
-				"metadata_csum.  Filesystem must be unmounted "
-				"\nto safely rewrite all metadata to "
-				"match the new UUID.\n"), stderr);
-			return 1;
+		if (fs->super->s_checksum_seed != uuid_seed) {
+			if (mount_flags & (EXT2_MF_BUSY|EXT2_MF_MOUNTED)) {
+				fputs(_("UUID has changed since enabling "
+		"metadata_csum.  Filesystem must be unmounted "
+		"\nto safely rewrite all metadata to match the new UUID.\n"),
+				      stderr);
+				return 1;
+			}
+			check_fsck_needed(fs, _("Recalculating checksums "
+						"could take some time."));
+			rewrite_checksums = 1;
 		}
-
-		rewrite_checksums = 1;
 	}
 
 	if (sb->s_rev_level == EXT2_GOOD_OLD_REV &&
-- 
2.16.1.72.g5be1f00a9a

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ