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: <20251030171704.GB1624@sol>
Date: Thu, 30 Oct 2025 10:17:04 -0700
From: Eric Biggers <ebiggers@...nel.org>
To: Christoph Hellwig <hch@....de>
Cc: Carlos Llamas <cmllamas@...gle.com>, Jens Axboe <axboe@...nel.dk>,
	kernel-team@...roid.com, linux-kernel@...r.kernel.org,
	"open list:BLOCK LAYER" <linux-block@...r.kernel.org>
Subject: Re: [PATCH] blk-crypto: use BLK_STS_INVAL for alignment errors

On Thu, Oct 30, 2025 at 07:03:03AM +0100, Christoph Hellwig wrote:
> On Thu, Oct 30, 2025 at 04:39:18AM +0000, Carlos Llamas wrote:
> > Make __blk_crypto_bio_prep() propagate BLK_STS_INVAL when IO segments
> > fail the data unit alignment check.
> > 
> > This was flagged by an LTP test that expects EINVAL when performing an
> > O_DIRECT read with a misaligned buffer [1].
> > 
> > Cc: Eric Biggers <ebiggers@...nel.org>
> > Cc: Christoph Hellwig <hch@....de>
> > Link: https://lore.kernel.org/all/aP-c5gPjrpsn0vJA@google.com/ [1]
> > Signed-off-by: Carlos Llamas <cmllamas@...gle.com>
> > ---
> >  block/blk-crypto.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/block/blk-crypto.c b/block/blk-crypto.c
> > index 4b1ad84d1b5a..3e7bf1974cbd 100644
> > --- a/block/blk-crypto.c
> > +++ b/block/blk-crypto.c
> > @@ -292,7 +292,7 @@ bool __blk_crypto_bio_prep(struct bio **bio_ptr)
> >  	}
> >  
> >  	if (!bio_crypt_check_alignment(bio)) {
> > -		bio->bi_status = BLK_STS_IOERR;
> > +		bio->bi_status = BLK_STS_INVAL;
> >  		goto fail;
> 
> Note that the dio_mem_align reporting in ext4 and f2fs also need to
> be updated to account for this.

I'm not sure what you mean.  They already take encryption into account
and report dio_mem_align=filesystem_block_size on encrypted files.

- Eric

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ