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: <20210607110657.GB6729@lst.de>
Date:   Mon, 7 Jun 2021 13:06:57 +0200
From:   Christoph Hellwig <hch@....de>
To:     Coly Li <colyli@...e.de>
Cc:     axboe@...nel.dk, linux-bcache@...r.kernel.org,
        linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
        Alexander Ullrich <ealex1979@...il.com>,
        Diego Ercolani <diego.ercolani@...il.com>,
        Jan Szubiak <jan.szubiak@...uxpolska.pl>,
        Marco Rebhan <me@...saiko.net>,
        Matthias Ferdinand <bcache@...dv.net>,
        Victor Westerhuis <victor@...terhu.is>,
        Vojtech Pavlik <vojtech@...e.cz>,
        Rolf Fokkens <rolf@...ffokkens.nl>,
        Thorsten Knabe <linux@...rsten-knabe.de>,
        stable@...r.kernel.org, Christoph Hellwig <hch@....de>,
        Kent Overstreet <kent.overstreet@...il.com>,
        Nix <nix@...eri.org.uk>, Takashi Iwai <tiwai@...e.com>
Subject: Re: [PATCH v5 2/2] bcache: avoid oversized read request in cache
 missing code path

On Mon, Jun 07, 2021 at 06:35:39PM +0800, Coly Li wrote:
> +	/* Limitation for valid replace key size and cache_bio bvecs number */
> +	size_limit = min_t(unsigned int, bio_max_segs(UINT_MAX) * PAGE_SECTORS,
> +			   (1 << KEY_SIZE_BITS) - 1);

bio_max_segs kaps the argument to BIO_MAX_VECS, so you might as well
directly write BIO_MAX_VECS.  Can you explain the PAGE_SECTORS here a bit
more? Does this code path use discontiguous per-sector allocations?
Preferably in a comment.

> +	s->insert_bio_sectors = min3(size_limit, sectors, bio_sectors(bio));

Also I don't really understand the units involved here.
s->insert_bio_sectors, sectors, and bio_sectors is in unit of 512 byte
sectors.  

> -	miss = bio_next_split(bio, sectors, GFP_NOIO, &s->d->bio_split);
> +	miss = bio_next_split(bio, s->insert_bio_sectors, GFP_NOIO, &s->d->bio_split);

Overly long line.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ