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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180627144439.GC3348@thunk.org>
Date:   Wed, 27 Jun 2018 10:44:39 -0400
From:   "Theodore Y. Ts'o" <tytso@....edu>
To:     Lukas Czerner <lczerner@...hat.com>
Cc:     linux-ext4@...r.kernel.org, adilger@...ger.ca
Subject: Re: test f_extent_htree fails on 1.44.3-rc1

On Wed, Jun 27, 2018 at 02:32:05PM +0200, Lukas Czerner wrote:
> 
> just letting you know that indeed, when disabling set_inode_xattr() in
> __populate_fs() the test runs ok. If you don't already have one I'll
> work on a patch to add this option.

Already done, I just didn't have a chance to send it out last night.

commit 8cec4acdc03a449e8b193948ebce22fe4ad21324
Author: Theodore Ts'o <tytso@....edu>
Date:   Tue Jun 26 15:21:28 2018 -0400

    tests, mke2fs: add option to suppress xattr copying to fix f_extent_htree
    
    If the developer is running with SELinux enabled on /tmp, the
    f_extent_htree regression test will fail because mke2fs by default
    copies the extended attributes into the newly created file system (if
    a directory hierarchy is specified via the -d option).
    
    Fix this by adding a new extended option to mke2fs, -E no_copy_xattrs
    and using it in f_extent_htree's test script.
    
    Reported-by: Lukas Czerner <lczerner@...hat.com>
    Signed-off-by: Theodore Ts'o <tytso@....edu>

diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c
index fe859d458..0b04508ef 100644
--- a/debugfs/debugfs.c
+++ b/debugfs/debugfs.c
@@ -55,6 +55,7 @@ int sci_idx;
 ext2_filsys	current_fs;
 quota_ctx_t	current_qctx;
 ext2_ino_t	root, cwd;
+int		no_copy_xattrs;
 
 static int debugfs_setup_tdb(const char *device_name, char *undo_file,
 			     io_manager *io_ptr)
diff --git a/misc/create_inode.c b/misc/create_inode.c
index 6621b0ab7..05aa63638 100644
--- a/misc/create_inode.c
+++ b/misc/create_inode.c
@@ -142,6 +142,9 @@ static errcode_t set_inode_xattr(ext2_filsys fs, ext2_ino_t ino,
 	char				*list = NULL;
 	int				i;
 
+	if (no_copy_xattrs)
+		return 0;
+
 	size = llistxattr(filename, NULL, 0);
 	if (size == -1) {
 		retval = errno;
diff --git a/misc/create_inode.h b/misc/create_inode.h
index 3a376322a..b5eeb420f 100644
--- a/misc/create_inode.h
+++ b/misc/create_inode.h
@@ -33,6 +33,9 @@ struct fs_ops_callbacks {
 		ext2_ino_t parent_ino, ext2_ino_t root, mode_t mode);
 };
 
+extern int no_copy_xattrs; 	/* this should eventually be a flag
+				   passed to populate_fs3() */
+
 /* For populating the filesystem */
 extern errcode_t populate_fs(ext2_filsys fs, ext2_ino_t parent_ino,
 			     const char *source_dir, ext2_ino_t root);
diff --git a/misc/mke2fs.8.in b/misc/mke2fs.8.in
index 7b989e0bd..603e37e54 100644
--- a/misc/mke2fs.8.in
+++ b/misc/mke2fs.8.in
@@ -338,6 +338,15 @@ small risk if the system crashes before the journal has been overwritten
 entirely one time.  If the option value is omitted, it defaults to 1 to
 enable lazy journal inode zeroing.
 .TP
+.BI no_copy_xattrs
+Normally
+.B mke2fs
+will copy the extended attributes of the files in the directory
+hierarchy specified via the (optional)
+.B \-d
+option.  This will disable the copy and leaves the files in the newly
+created file system without any extended attributes.
+.TP
 .BI num_backup_sb= <0|1|2>
 If the
 .B sparse_super2
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index ce78b7c82..b23ea766c 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -95,6 +95,7 @@ int	journal_size;
 int	journal_flags;
 static int	lazy_itable_init;
 static int	packed_meta_blocks;
+int		no_copy_xattrs;
 static char	*bad_blocks_filename = NULL;
 static __u32	fs_stride;
 /* Initialize usr/grp quotas by default */
@@ -880,6 +881,9 @@ static void parse_extended_opts(struct ext2_super_block *param,
 				r_usage++;
 				continue;
 			}
+		} else if (strcmp(token, "no_copy_xattrs") == 0) {
+			no_copy_xattrs = 1;
+			continue;
 		} else if (strcmp(token, "num_backup_sb") == 0) {
 			if (!arg) {
 				r_usage++;
diff --git a/tests/f_extent_htree/script b/tests/f_extent_htree/script
index ccd97e14f..4939accc3 100644
--- a/tests/f_extent_htree/script
+++ b/tests/f_extent_htree/script
@@ -30,8 +30,8 @@ fi
 # make filesystem with enough inodes and blocks to hold all the test files
 > $TMPFILE
 NUM=$((NUM * 5 / 3))
-echo "mke2fs -b $BSIZE -O dir_index,extent -d$SRC -N$NUM $TMPFILE $NUM" >> $OUT
-$MKE2FS -b $BSIZE -O dir_index,extent -d$SRC -N$NUM $TMPFILE $NUM >> $OUT 2>&1
+echo "mke2fs -b $BSIZE -O dir_index,extent -E no_copy_xattrs -d$SRC -N$NUM $TMPFILE $NUM" >> $OUT
+$MKE2FS -b $BSIZE -O dir_index,extent -E no_copy_xattrs -d$SRC -N$NUM $TMPFILE $NUM >> $OUT 2>&1
 rm -r $SRC
 
 # Run e2fsck to convert dir to htree before deleting the files, as mke2fs


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ