Linux block layer
 help / color / mirror / Atom feed
From: Keith Busch <kbusch@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Keith Busch <kbusch@meta.com>,
	linux-block@vger.kernel.org, axboe@kernel.dk,
	Carlos Maiolino <cem@kernel.org>
Subject: Re: [PATCH] block: check bio split for unaligned bvec
Date: Mon, 15 Jun 2026 16:08:41 -0600	[thread overview]
Message-ID: <ajB36Wt9lU_F-r7h@kbusch-mbp> (raw)
In-Reply-To: <20260615133549.GC26132@lst.de>

On Mon, Jun 15, 2026 at 03:35:49PM +0200, Christoph Hellwig wrote:
> On Fri, Jun 12, 2026 at 03:32:04PM -0700, Keith Busch wrote:
> > From: Keith Busch <kbusch@kernel.org>
> > 
> > Offsets and lengths need to be validated against the dma alignment. This
> > check was skipped for sufficiently a small bio with a single bvec, which
> > may allow an invalid request dispatched to the driver. Force the
> > validation for an unaligned bvec by forcing the bio split path that
> > handles this condition.
> 
> This fix itself looks good, but we'll also need something similar
> for bio-based drivers that never call into the splitting helper.

Totally agree. I'm looking at all the .submit_bio drivers, and I think
they fall into one of four catagories:

  1: already split (md/nvme-mp/drbd; dm conditional)
  2: don't split
      * btt, dcssblk: already reject unaligned
      * n64cart: WARNs, but potentially proceeds to undefined behavior
      * nfhd: silently corrupts, but looks like a driver problem
  3: can handle arbitrary memory but advertise default dma_alignment=511
      (brd, pmem, zram, ps3vram, simdisk - "limits lie")
  4: forward/self-split (bcache)

I think the block layer can fix 3 with a BLK_FEAT flag to allow a zero
dma_alignment limit for the drivers that really don't need it from the
source buffer.

As for the rest, I don't know of anyone caring to ensure n64 or nfhd are
correctly handling degenerate applications.

  reply	other threads:[~2026-06-15 22:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-12 22:32 [PATCH] block: check bio split for unaligned bvec Keith Busch
2026-06-13 12:36 ` Jens Axboe
2026-06-15  9:37 ` Carlos Maiolino
2026-06-15 13:35 ` Christoph Hellwig
2026-06-15 22:08   ` Keith Busch [this message]
2026-06-16 15:36     ` Keith Busch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ajB36Wt9lU_F-r7h@kbusch-mbp \
    --to=kbusch@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=cem@kernel.org \
    --cc=hch@lst.de \
    --cc=kbusch@meta.com \
    --cc=linux-block@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox