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  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]
Date:   Thu, 3 Dec 2020 19:28:11 -0800
From:   Eric Biggers <ebiggers@...nel.org>
To:     Daeho Jeong <daeho43@...il.com>
Cc:     linux-kernel@...r.kernel.org,
        linux-f2fs-devel@...ts.sourceforge.net, kernel-team@...roid.com,
        Daeho Jeong <daehojeong@...gle.com>
Subject: Re: [f2fs-dev] [PATCH] f2fs: fix race of pending_pages in
 decompression

On Fri, Dec 04, 2020 at 09:58:47AM +0900, Daeho Jeong wrote:
> diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
> index 87090da8693d..cdf72e153da0 100644
> --- a/fs/f2fs/compress.c
> +++ b/fs/f2fs/compress.c
> @@ -803,8 +803,6 @@ void f2fs_decompress_pages(struct bio *bio, struct page *page, bool verity)
>  	if (cops->destroy_decompress_ctx)
>  		cops->destroy_decompress_ctx(dic);
>  out_free_dic:
> -	if (verity)
> -		atomic_set(&dic->pending_pages, dic->nr_cpages);
>  	if (!verity)
>  		f2fs_decompress_end_io(dic->rpages, dic->cluster_size,
>  								ret, false);
> @@ -1498,6 +1496,8 @@ struct decompress_io_ctx *f2fs_alloc_dic(struct compress_ctx *cc)
>  	dic->magic = F2FS_COMPRESSED_PAGE_MAGIC;
>  	dic->inode = cc->inode;
>  	atomic_set(&dic->pending_pages, cc->nr_cpages);
> +	if (fsverity_active(cc->inode))
> +		atomic_set(&dic->verity_pages, cc->nr_cpages);
>  	dic->cluster_idx = cc->cluster_idx;
>  	dic->cluster_size = cc->cluster_size;
>  	dic->log_cluster_size = cc->log_cluster_size;

The check for fsverity_active() is wrong.  It looks like you need to know
whether the bio needs to go through the fs-verity data verification.  The
correct way to determine that is to check whether STEP_VERITY is enabled in the
bio's bio_post_read_ctx.  It's set by f2fs_grab_read_bio() when needed.

- Eric

Powered by blists - more mailing lists