Re: [PATCH] io_uring/rsrc: fix slab-out-of-bounds in io_buffer_register_bvec

From: Christoph Hellwig

Date: Mon Dec 22 2025 - 17:08:49 EST


On Mon, Dec 22, 2025 at 07:29:31AM +0800, Keith Busch wrote:
> > The above is simply an open coded version of doing repeated
> > __bio_add_page calls. Which would be rather suboptimal, but perfectly
> > valid.
>
> Yeah, there's nothing stopping someone from using it that way, but a
> quick survey of __bio_add_page() users appear to be special cases that
> allocate a single vector bio, so its existing use is a short-cut that
> bio_add_page() will inevitiably reach anyway. Did you intend for it to
> be called directly for multiple vector uses too? It is suboptimal as you
> said, so it still feels like a misuse if someone did that.

We can't even force users to use __bio_add_page. Take a look at
drivers/md/bcache/util.c:bch_bio_map() for a real-life example for
something that could create this bvec pattern.