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:	Mon,  9 Jan 2012 16:45:03 +0100
From:	Lukas Czerner <lczerner@...hat.com>
To:	linux-ext4@...r.kernel.org
Cc:	tytso@....edu, Lukas Czerner <lczerner@...hat.com>
Subject: [PATCH] ext4: setattr: Forbid setting data journalling when delalloc enabled

Ext4 does not support data journalling with delayed allocation enabled.
We even does not allow to mount the file system with delayed allocation
and data journalling enabled, but it can be set via FS_IOC_SETFLAGS
which is wrong.

When data journalling and delayed allocation is enabled it can lead to
troubles. Here is one example how to reproduce an oops:

 mkfs.ext4 /dev/sdd
 mount /dev/sdd /mnt/test1
 dd if=/dev/zero of=/mnt/test1/file bs=1M count=4
 chattr +j /mnt/test1/file
 dd if=/dev/zero of=/mnt/test1/file bs=1M count=4 conv=notrunc
 chattr -j /mnt/test1/file

Signed-off-by: Lukas Czerner <lczerner@...hat.com>
---
 fs/ext4/ioctl.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
index a567968..f1b8226 100644
--- a/fs/ext4/ioctl.c
+++ b/fs/ext4/ioctl.c
@@ -126,7 +126,21 @@ flags_err:
 		if (err)
 			goto flags_out;
 
+		/*
+		 * We absolutely can not journal data when delayed allocation
+		 * is enabled. This is not possible to do via mount option
+		 * and it should not be possible to do via setattr as well.
+		 * Delayed allocation with data=journal is simply not
+		 * supported.
+		 */
 		if ((jflag ^ oldflags) & (EXT4_JOURNAL_DATA_FL))
+			if (test_opt(sb, DELALLOC)) {
+				ext4_msg(sb, KERN_ERR,
+					 "Data journalling not supported "
+					 "with delayed allocation.");
+				err = -EOPNOTSUPP;
+				goto flags_out;
+			}
 			err = ext4_change_inode_journal_flag(inode, jflag);
 		if (err)
 			goto flags_out;
-- 
1.7.4.4

--
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