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] [day] [month] [year] [list]
Message-ID: <lpf4hlxv2e3dd527xmbueuquvo37c23e7mfuiedrjaullr3ilk@6ifh3tkjgyp2>
Date: Thu, 26 Jun 2025 09:19:45 +0200
From: Jan Kara <jack@...e.cz>
To: "Pankaj Raghav (Samsung)" <kernel@...kajraghav.com>
Cc: Jan Kara <jack@...e.cz>, Pankaj Raghav <p.raghav@...sung.com>, 
	Alexander Viro <viro@...iv.linux.org.uk>, mcgrof@...nel.org, Christian Brauner <brauner@...nel.org>, 
	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org, gost.dev@...sung.com, 
	Matthew Wilcox <willy@...radead.org>
Subject: Re: [PATCH v3] fs/buffer: remove the min and max limit checks in
 __getblk_slow()

On Wed 25-06-25 12:53:54, Pankaj Raghav (Samsung) wrote:
> On Wed, Jun 25, 2025 at 12:16:49PM +0200, Jan Kara wrote:
> > On Wed 25-06-25 10:37:04, Pankaj Raghav wrote:
> > > All filesystems will already check the max and min value of their block
> > > size during their initialization. __getblk_slow() is a very low-level
> > > function to have these checks. Remove them and only check for logical
> > > block size alignment.
> > > 
> > > Suggested-by: Matthew Wilcox <willy@...radead.org>
> > > Signed-off-by: Pankaj Raghav <p.raghav@...sung.com>
> > 
> > I know this is a bikeshedding but FWIW this is in the should never trigger
> > territory so I'd be inclined to just make it WARN_ON_ONCE() and completely
> > delete it once we refactor bh apis to make sure nobody can call bh
> > functions with anything else than sb->s_blocksize.
> > 
> Something like this:
> 
> diff --git a/fs/buffer.c b/fs/buffer.c
> index a1aa01ebc0ce..a49b4be37c62 100644
> --- a/fs/buffer.c
> +++ b/fs/buffer.c
> @@ -1122,10 +1122,9 @@ __getblk_slow(struct block_device *bdev, sector_t block,
>  {
>         bool blocking = gfpflags_allow_blocking(gfp);
>  
> -       if (unlikely(size & (bdev_logical_block_size(bdev) - 1))) {
> +       if (WARN_ON_ONCE(size & (bdev_logical_block_size(bdev) - 1))) {
>                 printk(KERN_ERR "getblk(): block size %d not aligned to logical block size %d\n",
>                        size, bdev_logical_block_size(bdev));
> -               dump_stack();
>                 return NULL;
>         }
> 
> I assume we don't need the dump_stack() anymore as we will print them
> with WARN_ON_ONCE anyway?

Correct. Thanks! Feel free to add:

Reviewed-by: Jan Kara <jack@...e.cz>

								Honza
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ