public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Andreas Hindborg <a.hindborg@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>,
	Oliver Mangold <oliver.mangold@pm.me>,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] block: set bi_vcnt when cloning bio
Date: Wed, 19 Feb 2025 22:11:36 -0800	[thread overview]
Message-ID: <Z7bHmJHI1ewrFZsa@infradead.org> (raw)
In-Reply-To: <20250215-clone-bi_vcnt-v1-1-5d00c95fd53a@kernel.org>

On Sat, Feb 15, 2025 at 11:58:15AM +0100, Andreas Hindborg wrote:
> When cloning a bio, the `bio.bi_vcnt` field is not cloned. This is a
> problem if users want to perform bounds checks on the `bio.bi_io_vec`
> field.

Right now bi_vcnt is supposed to be an implementation detail for
bio_add_*, which obviously can't be called on cloned bio. Except for the
usual abuse in bcache/bcachefs that has mostly kept up except for a few
read-only checks in the completion routines which also can't be called
on cloned bios.

It would be nice to use it as a __counted_by bound for bi_io_vec, but
until that is supported on pointers in addition to the flexible arrays
we can't actually do that.  So as-is I don't really see a point in
just assigning the value if we don't actually use it.

      parent reply	other threads:[~2025-02-20  6:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-15 10:58 [PATCH] block: set bi_vcnt when cloning bio Andreas Hindborg
2025-02-18 10:40 ` John Garry
2025-02-18 11:40   ` Andreas Hindborg
2025-02-18 17:12     ` John Garry
2025-02-18 18:20       ` Andreas Hindborg
2025-02-18 22:21       ` Bart Van Assche
2025-02-19 14:19         ` John Garry
2025-02-20  6:11 ` Christoph Hellwig [this message]

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=Z7bHmJHI1ewrFZsa@infradead.org \
    --to=hch@infradead.org \
    --cc=a.hindborg@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oliver.mangold@pm.me \
    /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