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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 28 Jul 2011 17:17:04 +0200
From:	Jan Kara <jack@...e.cz>
To:	Ted Tso <tytso@....edu>
Cc:	linux-ext4@...r.kernel.org, Jan Kara <jack@...e.cz>
Subject: [PATCH] dumpe2fs: Warn when filesystem is mounted read-write

When dumpe2fs is used on a filesystem mounted read-write, printed information
may be old and inconsistent because e.g. updates of some superblock fields
happen lazily or because we do not really try to handle various intermediate
states of filesystem operations. Document this in the manpage and warn user
when dumpe2fs is used for such filesystem.

Signed-off-by: Jan Kara <jack@...e.cz>
---
 misc/dumpe2fs.8.in |    3 ++-
 misc/dumpe2fs.c    |   14 ++++++++++++++
 2 files changed, 16 insertions(+), 1 deletions(-)

  Ted, would you take this change? We actually had to explain to our users that
what they were doing isn't really going to work reliably...

diff --git a/misc/dumpe2fs.8.in b/misc/dumpe2fs.8.in
index c1dfcbd..e1336dc 100644
--- a/misc/dumpe2fs.8.in
+++ b/misc/dumpe2fs.8.in
@@ -71,7 +71,8 @@ print the version number of
 and exit.
 .SH BUGS
 You need to know the physical filesystem structure to understand the
-output.
+output. When used with a mounted filesystem, the printed information may be
+old or inconsistent.
 .SH AUTHOR
 .B dumpe2fs 
 was written by Remy Card <Remy.Card@...ux.org>.  It is currently being
diff --git a/misc/dumpe2fs.c b/misc/dumpe2fs.c
index 9a0dd46..fa1362a 100644
--- a/misc/dumpe2fs.c
+++ b/misc/dumpe2fs.c
@@ -495,6 +495,7 @@ int main (int argc, char ** argv)
 	int		flags;
 	int		header_only = 0;
 	int		c;
+	int		mount_flags;
 
 #ifdef ENABLE_NLS
 	setlocale(LC_MESSAGES, "");
@@ -567,6 +568,13 @@ int main (int argc, char ** argv)
 		printf (_("Couldn't find valid filesystem superblock.\n"));
 		exit (1);
 	}
+	retval = ext2fs_check_if_mounted(device_name, &mount_flags);
+	if (retval) {
+		com_err("ext2fs_check_if_mount", retval,
+			_("while determining whether %s is mounted."),
+			device_name);
+		exit(1);
+	}
 	if (print_badblocks) {
 		list_bad_blocks(fs, 1);
 	} else {
@@ -595,6 +603,12 @@ int main (int argc, char ** argv)
 		}
 	}
 	ext2fs_close (fs);
+	if ((mount_flags & EXT2_MF_MOUNTED) &&
+	    !(mount_flags & EXT2_MF_READONLY)) {
+		fputs(_("The filesystem is read-write mounted so printed"
+			" information may be old or inconsistent.\n"), stderr);
+	}
+
 	remove_error_table(&et_ext2_error_table);
 	exit (0);
 }
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ