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] [day] [month] [year] [list]
Message-ID: <20210804151535.GG4578@quack2.suse.cz>
Date:   Wed, 4 Aug 2021 17:15:35 +0200
From:   Jan Kara <jack@...e.cz>
To:     Artem Blagodarenko <artem.blagodarenko@...il.com>
Cc:     linux-ext4@...r.kernel.org, adilger.kernel@...ger.ca,
        Denis Lukianov <denis@...elsoft.com>
Subject: Re: [PATCH] ext4: fix directory index node split corruption

On Fri 30-07-21 14:24:03, Artem Blagodarenko wrote:
> I send patch whose author is Denis Lukianov <denis@...elsoft.com>
> His messages can't reach this list somehow.
> I only rebased it ontop of master's HEAD and tested that it fixes
> the problem and reviewed.
> 
> ----
> 
> Following commit b5776e7, a trivial sequential write of empty files to
> an empty ext4 file system (with large_dir enabled) fails after just
> over 26 million files. Depending on luck, file creation will give error
> EEXIST or EUCLEAN.
> 
> Commit b5776e7 fixed the no-restart condition so that
> ext4_handle_dirty_dx_node is always called, but it also broke the
> restart condition. This is because when restart=1, the original
> implementation correctly skipped do_split() but b5776e7 clobbered the
> "if(restart)goto journal_error;" logic.
> 
> This complementary change protects do_split() from restart condition,
> making it safe from both current and future ordering of goto statements
> in earlier sections of the code.
> 
> Tested on 5.11.20 with handy testing script:
> 
> i = 0
> while i <= 32000000:
>     print (i)
>     with open('tmpmnt/%d' % i, 'wb') as fout:
>         i += 1
> 
> Google-Bug-Id: 176345532
> Fixes: b5776e7 ("ext4: fix potential htree index checksum corruption")

Please use 12 characters from git commit when identifying it (7 characters 
is likely to become non-unique). Otherwise the fix looks good so feel free
to add:

Reviewed-by: Jan Kara <jack@...e.cz>

Also I think you should include Ted in 'To' or 'CC' to make it more likely
he sees the patch.

								Honza


> Signed-off-by: Denis Lukianov <denis@...elsoft.com>
> Signed-off-by: Artem Blagodarenko <artem.blagodarenko@...il.com>
> ---
>  fs/ext4/namei.c | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
> index 5fd56f616cf0..0bbff03d4167 100644
> --- a/fs/ext4/namei.c
> +++ b/fs/ext4/namei.c
> @@ -2542,13 +2542,16 @@ static int ext4_dx_add_entry(handle_t *handle, struct ext4_filename *fname,
>  			goto journal_error;
>  		}
>  	}
> -	de = do_split(handle, dir, &bh, frame, &fname->hinfo);
> -	if (IS_ERR(de)) {
> -		err = PTR_ERR(de);
> +	if (!restart) {
> +		de = do_split(handle, dir, &bh, frame, &fname->hinfo);
> +		if (IS_ERR(de)) {
> +			err = PTR_ERR(de);
> +			goto cleanup;
> +		}
> +		err = add_dirent_to_buf(handle, fname, dir, inode, de,
> +bh);
>  		goto cleanup;
>  	}
> -	err = add_dirent_to_buf(handle, fname, dir, inode, de, bh);
> -	goto cleanup;
>  
>  journal_error:
>  	ext4_std_error(dir->i_sb, err); /* this is a no-op if err == 0 */
> -- 
> 2.18.4
> 
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ