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: <20210517101523.GB31755@quack2.suse.cz>
Date:   Mon, 17 May 2021 12:15:23 +0200
From:   Jan Kara <jack@...e.cz>
To:     Pavel Skripkin <paskripkin@...il.com>
Cc:     jack@...e.cz, tiantao6@...ilicon.com, rdunlap@...radead.org,
        reiserfs-devel@...r.kernel.org, linux-kernel@...r.kernel.org,
        syzbot+0ba9909df31c6a36974d@...kaller.appspotmail.com
Subject: Re: [PATCH] reiserfs: add check for invalid 1st journal block

On Sat 15-05-21 00:23:35, Pavel Skripkin wrote:
> syzbot reported divide error in reiserfs.
> The problem was in incorrect journal 1st block.
> 
> Syzbot's reproducer manualy generated wrong superblock
> with incorrect 1st block. In journal_init() wasn't
> any checks about this particular case.
> 
> For example, if 1st journal block is before superblock
> 1st block, it can cause zeroing important superblock members
> in do_journal_end().
> 
> Reported-and-tested-by: syzbot+0ba9909df31c6a36974d@...kaller.appspotmail.com
> Signed-off-by: Pavel Skripkin <paskripkin@...il.com>

Thanks for the patch. One comment below:

> diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
> index 9edc8e2b154e..d58f24a08385 100644
> --- a/fs/reiserfs/journal.c
> +++ b/fs/reiserfs/journal.c
> @@ -2758,6 +2758,19 @@ int journal_init(struct super_block *sb, const char *j_dev_name,
>  		goto free_and_return;
>  	}
>  
> +	/*
> +	 * Sanity check to see is journal first block correct.
> +	 * If journal first block is invalid it can cause
> +	 * zeroing important superblock members.
> +	 */
> +	if (SB_ONDISK_JOURNAL_1st_BLOCK(sb) < SB_JOURNAL_1st_RESERVED_BLOCK(sb)) {

I guess this check is valid only if !SB_ONDISK_JOURNAL_DEVICE(sb), isn't
it? Otherwise you are comparing block numbers from two different devices...

									Honza

> +		reiserfs_warning(sb, "journal-1393",
> +			"journal 1st super block is invalid: 1st reserved block %d, but actual 1st block is %d",
> +			SB_JOURNAL_1st_RESERVED_BLOCK(sb),
> +			SB_ONDISK_JOURNAL_1st_BLOCK(sb));
> +		goto free_and_return;
> +	}
> +
>  	if (journal_init_dev(sb, journal, j_dev_name) != 0) {
>  		reiserfs_warning(sb, "sh-462",
>  				 "unable to initialize journal device");
> -- 
> 2.31.1
> 
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ