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: <20231203051454.GE509422@mit.edu>
Date: Sun, 3 Dec 2023 00:14:54 -0500
From: "Theodore Ts'o" <tytso@....edu>
To: Srivathsa Dara <srivathsa.d.dara@...cle.com>
Cc: adilger.kernel@...ger.ca, linux-ext4@...r.kernel.org,
        rajesh.sivaramasubramaniom@...cle.com, junxiao.bi@...cle.com
Subject: Re: [RESEND PATCH] debugfs/htree.c: In do_dx_hash() read hash_seed,
 hash_version directly from superblock

On Thu, Aug 24, 2023 at 06:56:34AM +0000, Srivathsa Dara wrote:
> diff --git a/debugfs/htree.c b/debugfs/htree.c
> index 7fae7f11..2d881c74 100644
> --- a/debugfs/htree.c
> +++ b/debugfs/htree.c
> @@ -316,7 +316,12 @@ void do_dx_hash(int argc, char *argv[], int sci_idx EXT2FS_ATTR((unused)),
>  	int		hash_flags = 0;
>  	const struct ext2fs_nls_table *encoding = NULL;
>  
> -	hash_seed[0] = hash_seed[1] = hash_seed[2] = hash_seed[3] = 0;
> +	hash_seed[0] = current_fs->super->s_hash_seed[0];
> +	hash_seed[1] = current_fs->super->s_hash_seed[1];
> +	hash_seed[2] = current_fs->super->s_hash_seed[2];
> +	hash_seed[3] = current_fs->super->s_hash_seed[3];
> +
> +	hash_version = current_fs->super->s_def_hash_version;
>  
>  	reset_getopt();
>  	while ((c = getopt(argc, argv, "h:s:ce:")) != EOF) {

The problem with this patch is that if a file system is not opened,
then current_fs is NULL.  As a result:

% gdb -q debugfs
Reading symbols from debugfs...
(gdb) run
Starting program: /build/e2fsprogs/debugfs/debugfs 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
debugfs 1.47.0 (5-Feb-2023)
debugfs:  dx_hash test1

Program received signal SIGSEGV, Segmentation fault.
0x000055555556f73d in do_dx_hash (argc=2, argv=0x5555555d38d0, sci_idx=1, infop=0x0)
    at /usr/projects/e2fsprogs/e2fsprogs/debugfs/htree.c:343
343             hash_seed[0] = current_fs->super->s_hash_seed[0];


To address this, I've fixed up your patch slightly.  (See below for
the fix up, as well as the final patch.)

Also, in the future, please make sure that the first line of the
commit is a summary of the patch, no longer than 75 characters, and
that the text is wrapped to no more than 75 characters.  (I personally
use 72 characters, but 75 is what suggested in the Linux Kernel's
submitting patches documentation[1] in the "The Canonical Patch
Format" section.)

[1] https://docs.kernel.org/process/submitting-patches.html

					- Ted



View attachment "fixup" of type "text/plain" (1038 bytes)

View attachment "final-patch" of type "text/plain" (1704 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ