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>] [day] [month] [year] [list]
Date:	Tue, 14 Jul 2015 15:33:14 +0300
From:	Alexey Lyashkov <alexey.lyashkov@...il.com>
To:	linux-ext4@...r.kernel.org
Subject: debugfs: fix debugfs dump for a hashed directory

debugfs produce wrong output for a htree command in some cases.
sync a htree structures with in kernel implementation.

---
 debugfs/htree.c      |  6 +++---
 lib/ext2fs/ext2_fs.h | 14 ++++++++++++++
 lib/ext2fs/ext2fs.h  |  2 +-
 3 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/debugfs/htree.c b/debugfs/htree.c
index 24f8250..d47793a 100644
--- a/debugfs/htree.c
+++ b/debugfs/htree.c
@@ -185,7 +185,7 @@ static void htree_dump_int_block(ext2_filsys fs, ext2_ino_t ino,
 	}
 
 	htree_dump_int_node(fs, ino, inode, rootnode,
-			    (struct ext2_dx_entry *) (buf+8),
+			    ((struct ext2_dx_node *)buf)->entries,
 			    cbuf, level);
 errout:
 	free(cbuf);
@@ -244,7 +244,7 @@ void do_htree_dump(int argc, char *argv[])
 		goto errout;
 	}
 
-	rootnode = (struct ext2_dx_root_info *) (buf + 24);
+	rootnode = get_ext2_dx_root_info(current_fs, buf);
 
 	fprintf(pager, "Root node dump:\n");
 	fprintf(pager, "\t Reserved zero: %u\n", rootnode->reserved_zero);
@@ -253,7 +253,7 @@ void do_htree_dump(int argc, char *argv[])
 	fprintf(pager, "\t Indirect levels: %d\n", rootnode->indirect_levels);
 	fprintf(pager, "\t Flags: %d\n", rootnode->unused_flags);
 
-	ent = (struct ext2_dx_entry *) (buf + 24 + rootnode->info_length);
+	ent = (struct ext2_dx_entry *) ((char *)rootnode + rootnode->info_length);
 
 	htree_dump_int_node(current_fs, ino, &inode, rootnode, ent,
 			    buf + current_fs->blocksize,
diff --git a/lib/ext2fs/ext2_fs.h b/lib/ext2fs/ext2_fs.h
index 8965f4c..d1397db 100644
--- a/lib/ext2fs/ext2_fs.h
+++ b/lib/ext2fs/ext2_fs.h
@@ -235,6 +235,20 @@ struct ext2_dx_countlimit {
 	__u16 count;
 };
 
+struct fake_dirent
+{
+	__u32 inode;
+	__u16 rec_len;
+	__u8 name_len;
+	__u8 file_type;
+};
+
+struct ext2_dx_node
+{
+	struct fake_dirent fake;
+	struct ext2_dx_entry	entries[0];
+};
+
 
 /*
  * Macro-instructions used to manage group descriptors

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