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: <aFQJoA6gyq6l56XS@casper.infradead.org>
Date: Thu, 19 Jun 2025 13:59:12 +0100
From: Matthew Wilcox <willy@...radead.org>
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 v2] fs/buffer: use min folio order to calculate upper
 limit in __getblk_slow()

On Thu, Jun 19, 2025 at 02:10:58PM +0200, Pankaj Raghav wrote:
> +++ b/fs/buffer.c
> @@ -1121,9 +1121,10 @@ __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);
>  
>  	if (unlikely(size & (bdev_logical_block_size(bdev) - 1) ||
> -		     (size < 512 || size > PAGE_SIZE))) {
> +		     (size < 512 || size > (1U << blocklog)))) {
>  		printk(KERN_ERR "getblk(): invalid block size %d requested\n",
>  					size);
>  		printk(KERN_ERR "logical block size: %d\n",

Is this what we want though?  If ext4 wants to create an 8kB block size
filesystem on top of a 512 byte sector size device, shouldn't it be
allowed to?  So just drop the max:

 	if (unlikely(size & (bdev_logical_block_size(bdev) - 1) ||
-		     (size < 512 || size > PAGE_SIZE))) {
+		     (size < 512)))) {

(also, surely logical_block_size is always at least 512, so do we really
need this check at all?)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ