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: <b831c93b507f4c06905abac95f3d5ff2@paragon-software.com>
Date:   Fri, 25 Dec 2020 14:27:48 +0000
From:   Konstantin Komarov <almaz.alexandrovich@...agon-software.com>
To:     Eric Biggers <ebiggers@...nel.org>
CC:     "linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
        "viro@...iv.linux.org.uk" <viro@...iv.linux.org.uk>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "pali@...nel.org" <pali@...nel.org>,
        "dsterba@...e.cz" <dsterba@...e.cz>,
        "aaptel@...e.com" <aaptel@...e.com>,
        "willy@...radead.org" <willy@...radead.org>,
        "rdunlap@...radead.org" <rdunlap@...radead.org>,
        "joe@...ches.com" <joe@...ches.com>,
        "mark@...mstone.com" <mark@...mstone.com>,
        "nborisov@...e.com" <nborisov@...e.com>,
        "linux-ntfs-dev@...ts.sourceforge.net" 
        <linux-ntfs-dev@...ts.sourceforge.net>,
        "anton@...era.com" <anton@...era.com>,
        "dan.carpenter@...cle.com" <dan.carpenter@...cle.com>,
        "hch@....de" <hch@....de>
Subject: RE: [PATCH v14 04/10] fs/ntfs3: Add file operations and
 implementation

Sent: Friday, December 11, 2020 7:31 PM
> To: 'Eric Biggers' <ebiggers@...nel.org>
> Cc: linux-fsdevel@...r.kernel.org; viro@...iv.linux.org.uk; linux-kernel@...r.kernel.org; pali@...nel.org; dsterba@...e.cz;
> aaptel@...e.com; willy@...radead.org; rdunlap@...radead.org; joe@...ches.com; mark@...mstone.com; nborisov@...e.com;
> linux-ntfs-dev@...ts.sourceforge.net; anton@...era.com; dan.carpenter@...cle.com; hch@....de
> Subject: RE: [PATCH v14 04/10] fs/ntfs3: Add file operations and implementation
> 
> From: Eric Biggers <ebiggers@...nel.org>
> Sent: Friday, December 4, 2020 9:42 PM
> > To: Konstantin Komarov <almaz.alexandrovich@...agon-software.com>
> > Cc: linux-fsdevel@...r.kernel.org; viro@...iv.linux.org.uk; linux-kernel@...r.kernel.org; pali@...nel.org; dsterba@...e.cz;
> > aaptel@...e.com; willy@...radead.org; rdunlap@...radead.org; joe@...ches.com; mark@...mstone.com; nborisov@...e.com;
> > linux-ntfs-dev@...ts.sourceforge.net; anton@...era.com; dan.carpenter@...cle.com; hch@....de
> > Subject: Re: [PATCH v14 04/10] fs/ntfs3: Add file operations and implementation
> >
> > On Fri, Dec 04, 2020 at 06:45:54PM +0300, Konstantin Komarov wrote:
> > > +/* external compression lzx/xpress */
> > > +static int decompress_lzx_xpress(struct ntfs_sb_info *sbi, const char *cmpr,
> > > +				 size_t cmpr_size, void *unc, size_t unc_size,
> > > +				 u32 frame_size)
> > > +{
> > > +	int err;
> > > +	void *ctx;
> > > +
> > > +	if (cmpr_size == unc_size) {
> > > +		/* frame not compressed */
> > > +		memcpy(unc, cmpr, unc_size);
> > > +		return 0;
> > > +	}
> > > +
> > > +	err = 0;
> > > +	ctx = NULL;
> > > +	spin_lock(&sbi->compress.lock);
> > > +	if (frame_size == 0x8000) {
> > > +		/* LZX: frame compressed */
> > > +		if (!sbi->compress.lzx) {
> > > +			/* Lazy initialize lzx decompress context */
> > > +			spin_unlock(&sbi->compress.lock);
> > > +			ctx = lzx_allocate_decompressor(0x8000);
> > > +			if (!ctx)
> > > +				return -ENOMEM;
> > > +			if (IS_ERR(ctx)) {
> > > +				/* should never failed */
> > > +				err = PTR_ERR(ctx);
> > > +				goto out;
> > > +			}
> > > +
> > > +			spin_lock(&sbi->compress.lock);
> > > +			if (!sbi->compress.lzx) {
> > > +				sbi->compress.lzx = ctx;
> > > +				ctx = NULL;
> > > +			}
> > > +		}
> > > +
> > > +		if (lzx_decompress(sbi->compress.lzx, cmpr, cmpr_size, unc,
> > > +				   unc_size)) {
> > > +			err = -EINVAL;
> > > +		}
> > > +	} else {
> > > +		/* XPRESS: frame compressed */
> > > +		if (!sbi->compress.xpress) {
> > > +			/* Lazy initialize xpress decompress context */
> > > +			spin_unlock(&sbi->compress.lock);
> > > +			ctx = xpress_allocate_decompressor();
> > > +			if (!ctx)
> > > +				return -ENOMEM;
> > > +
> > > +			spin_lock(&sbi->compress.lock);
> > > +			if (!sbi->compress.xpress) {
> > > +				sbi->compress.xpress = ctx;
> > > +				ctx = NULL;
> > > +			}
> > > +		}
> > > +
> > > +		if (xpress_decompress(sbi->compress.xpress, cmpr, cmpr_size,
> > > +				      unc, unc_size)) {
> > > +			err = -EINVAL;
> > > +		}
> > > +	}
> > > +	spin_unlock(&sbi->compress.lock);
> > > +out:
> > > +	ntfs_free(ctx);
> > > +	return err;
> > > +}
> >
> > Decompression is a somewhat heavyweight operation.  Not the type of thing that
> > should be done while holding a spin lock.
> >
> > - Eric
> 
> Hi Eric! We plan to swap spinlock to mutex in the next version.
> 
> Best regards!

Hi Eric! Changed the global spinlock to the mutexes for each type of compression.
This should resolve the problem. Please check out the V16.

Thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ