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: <20191023084536.GA16289@architecture4>
Date:   Wed, 23 Oct 2019 16:45:36 +0800
From:   Gao Xiang <gaoxiang25@...wei.com>
To:     Chao Yu <yuchao0@...wei.com>
CC:     Chao Yu <chao@...nel.org>, <linux-erofs@...ts.ozlabs.org>,
        Gao Xiang <xiang@...nel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4] erofs: support superblock checksum

Hi Chao,

On Wed, Oct 23, 2019 at 04:15:29PM +0800, Chao Yu wrote:
> Hi, Xiang, Pratik,
> 
> On 2019/10/23 12:05, Gao Xiang wrote:

<snip>

> >  }
> >  
> > +static int erofs_superblock_csum_verify(struct super_block *sb, void *sbdata)
> > +{
> > +	struct erofs_super_block *dsb;
> > +	u32 expected_crc, nblocks, crc;
> > +	void *kaddr;
> > +	struct page *page;
> > +	int i;
> > +
> > +	dsb = kmemdup(sbdata + EROFS_SUPER_OFFSET,
> > +		      EROFS_BLKSIZ - EROFS_SUPER_OFFSET, GFP_KERNEL);
> > +	if (!dsb)
> > +		return -ENOMEM;
> > +
> > +	expected_crc = le32_to_cpu(dsb->checksum);
> > +	nblocks = le32_to_cpu(dsb->chksum_blocks);
> 
> Now, we try to use nblocks's value before checking its validation, I guess fuzz
> test can easily make the value extreme larger, result in checking latter blocks
> unnecessarily.
> 
> IMO, we'd better
> 1. check validation of superblock to make sure all fields in sb are valid
> 2. use .nblocks to count and check payload blocks following sb

That is quite a good point. :-)

My first thought is to check the following payloads of sb (e.g, some per-fs
metadata should be checked at mount time together. or for small images, check
the whole image at the mount time) as well since if we introduce a new feature
to some kernel version, forward compatibility needs to be considered. So it's
better to make proper scalability, for this case, we have some choices:
 1) limit `chksum_blocks' upbound at runtime (e.g. refuse >= 65536 blocks,
    totally 256M.)
 2) just get rid of the whole `chksum_blocks' mess and checksum the first 4k
    at all, don't consider any latter scalability.

Some perferred idea about this? I plan to release erofs-utils v1.0 tomorrow
and hold up this feature for the next erofs-utils release, but I think we can
get it ready for v5.5 since it is not quite complex feature...

Thanks,
Gao Xiang

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ