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: <rf5sve3v7vlkzae7ralok4vkkit24ashon3htmp56rmqshgcv5@a3bmz7mpkcwb>
Date: Wed, 18 Jun 2025 17:40:02 +0200
From: Jan Kara <jack@...e.cz>
To: Pankaj Raghav <p.raghav@...sung.com>
Cc: Alexander Viro <viro@...iv.linux.org.uk>, Jan Kara <jack@...e.cz>, 
	mcgrof@...nel.org, Christian Brauner <brauner@...nel.org>, 
	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org, gost.dev@...sung.com, 
	kernel@...kajraghav.com
Subject: Re: [PATCH] fs/buffer: use min folio order to calculate upper limit
 in __getblk_slow()

On Wed 18-06-25 11:17:10, Pankaj Raghav wrote:
> The maximum IO size that a block device can read as a single block is
> based on the min folio order and not the PAGE_SIZE as we have bs > ps
> support for block devices[1].
> 
> Calculate the upper limit based on the on min folio order.
> 
> [1] https://lore.kernel.org/linux-block/20250221223823.1680616-1-mcgrof@kernel.org/
> 
> Signed-off-by: Pankaj Raghav <p.raghav@...sung.com>

...

> ---
> I found this while I was adding bs > ps support to ext4. Ext4 uses this
> routine to read the superblock.
> 
>  fs/buffer.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/buffer.c b/fs/buffer.c
> index 8cf4a1dc481e..98f90da69a0a 100644
> --- a/fs/buffer.c
> +++ b/fs/buffer.c
> @@ -1121,10 +1121,11 @@ __getblk_slow(struct block_device *bdev, sector_t block,
>  	     unsigned size, gfp_t gfp)
>  {
>  	bool blocking = gfpflags_allow_blocking(gfp);
> +	int blocklog = PAGE_SHIFT + mapping_min_folio_order(bdev->bd_mapping);
>  
>  	/* Size must be multiple of hard sectorsize */
> -	if (unlikely(size & (bdev_logical_block_size(bdev)-1) ||
> -			(size < 512 || size > PAGE_SIZE))) {
> +	if (unlikely(size & (bdev_logical_block_size(bdev) - 1) ||
> +		     (size < 512 || size > (1U << blocklog)))) {

So this doesn't quite make sense to me.  Shouldn't it be capped from above
by PAGE_SIZE << mapping_max_folio_order(bdev->bd_mapping)?

								Honza


>  		printk(KERN_ERR "getblk(): invalid block size %d requested\n",
>  					size);
>  		printk(KERN_ERR "logical block size: %d\n",
> 
> base-commit: e04c78d86a9699d136910cfc0bdcf01087e3267e
> -- 
> 2.49.0
> 
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ