[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z7bHmJHI1ewrFZsa@infradead.org>
Date: Wed, 19 Feb 2025 22:11:36 -0800
From: Christoph Hellwig <hch@...radead.org>
To: Andreas Hindborg <a.hindborg@...nel.org>
Cc: Jens Axboe <axboe@...nel.dk>, Oliver Mangold <oliver.mangold@...me>,
linux-block@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] block: set bi_vcnt when cloning bio
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.
Powered by blists - more mailing lists