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: <20180306151835.4842-7-artem.blagodarenko@gmail.com>
Date:   Tue,  6 Mar 2018 18:18:34 +0300
From:   Artem Blagodarenko <artem.blagodarenko@...il.com>
To:     linux-ext4@...r.kernel.org
Cc:     adilger.kernel@...ger.ca
Subject: [PATCH v3 6/7] e2fsck: INODE64 high part is more important then LUFID

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 9ed1c193..e5c1504c 100644
--- a/e2fsck/pass2.c
+++ b/e2fsck/pass2.c
@@ -372,10 +372,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()
@@ -387,6 +391,11 @@ void ext2_fix_dirent_dirdata(struct ext2_dir_entry *de)
 								      flags);
 			int rlen = __EXT2_DIR_REC_LEN(name_len + dirdatalen);
 
+			if (current_flag == EXT2_DIRENT_INODE)
+				inop = lenp;
+
+			lenp += *lenp;
+
 			if (rlen > de->rec_len)
 				break;
 
@@ -394,6 +403,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