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: <20180504070923.45140-8-c17828@cray.com>
Date:   Fri,  4 May 2018 10:09:23 +0300
From:   c17828 <artem.blagodarenko@...il.com>
To:     linux-ext4@...r.kernel.org
Cc:     adilger.kernel@...ger.ca,
        Artem Blagodarenko <artem.blagodarenko@...il.com>
Subject: [PATCH v4 7/7] e2fsck: INODE64 high part is more important then LUFID

From: Artem Blagodarenko <artem.blagodarenko@...il.com>

Keep the INO64 field over LUFID, since it is both smaller,
and more important.

Lustre-bug: https://jira.hpdd.intel.com/browse/LU-9309
Signed-off-by: Artem Blagodarenko <artem.blagodarenko@...il.com>
---
 e2fsck/pass2.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/e2fsck/pass2.c b/e2fsck/pass2.c
index ef0b97c0..21cbcd8e 100644
--- a/e2fsck/pass2.c
+++ b/e2fsck/pass2.c
@@ -377,10 +377,14 @@ void ext2_fix_dirent_dirdata(struct ext2_dir_entry *de)
 	__u8 de_flags = (de->name_len >> 8) & ~EXT2_FT_MASK;
 	__u8 name_len = de->name_len & EXT2_NAME_LEN;
 	__u8 new_flag = 0;
+	char *startp = de->name + (de->name_len & EXT2_NAME_LEN) + 1 /* NUL */;
+	char *lenp = startp;
+	char *inop = NULL;
 	int i;
 
 	for (i = 0; i < 4; i++) {
-		__u8 flags = new_flag | (1 << i) << 4;
+		__u8 current_flag = (1 << i) << 4;
+		__u8 flags = new_flag | current_flag;
 
 		/* new_flag is accumulating flags that are set in de_flags
 		 * and still fit inside rec_len. ext2_get_dirent_dirdata_size()
@@ -392,6 +396,11 @@ void ext2_fix_dirent_dirdata(struct ext2_dir_entry *de)
 								      flags);
 			int rlen = EXT2_DIR_NAME_LEN(name_len + dirdatalen);
 
+			if (current_flag == EXT2_DIRENT_INODE)
+				inop = lenp;
+
+			lenp += *lenp;
+
 			if (rlen > de->rec_len)
 				break;
 
@@ -399,6 +408,17 @@ void ext2_fix_dirent_dirdata(struct ext2_dir_entry *de)
 		}
 	}
 
+	/* Keep the INO64 field over  LUFID, since it is both smaller,
+	 * and more important.
+	 */
+	if (inop && (ext2_get_dirdata_field_size(de, new_flag) >= 5) &&
+	    !(new_flag & EXT2_DIRENT_INODE)) {
+		new_flag &= ~EXT2_DIRENT_LUFID;
+		new_flag |= EXT2_DIRENT_INODE;
+		memmove(startp, inop,
+			ext2_get_dirdata_field_size(de, new_flag));
+	}
+
 	de->name_len = name_len | file_type | (new_flag << 8);
 }
 
-- 
2.14.3 (Apple Git-98)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ