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

From: Keith Busch

Date: Wed Dec 17 2025 - 19:56:55 EST


On Thu, Dec 18, 2025 at 12:37:47AM +0000, veygax wrote:
> /*
> * Add pages to bio manually.
> * We use physically contiguous pages to trick blk_rq_nr_phys_segments
> * into returning 1 segment.
> * We use multiple bvec entries to trick the loop in io_buffer_register_bvec
> * into writing out of bounds.
> */
> for (i = 0; i < num_bvecs; i++) {
> struct bio_vec *bv = &bio->bi_io_vec[i];
> bv->bv_page = page + i;
> bv->bv_len = PAGE_SIZE;
> bv->bv_offset = 0;
> bio->bi_vcnt++;
> bio->bi_iter.bi_size += PAGE_SIZE;
> }

I believe you're supposed to use the bio_add_page() API rather than open
code the bvec setup.