Skip to content
Commit 06fe9b1d authored by Jens Axboe's avatar Jens Axboe
Browse files

io_uring: don't attempt to mmap larger than what the user asks for



If IORING_FEAT_SINGLE_MMAP is ignored, as can happen if an application
uses an ancient liburing or does setup manually, then 3 mmap's are
required to map the ring into userspace. The kernel will still have
collapsed the mappings, however userspace may ask for mapping them
individually. If so, then we should not use the full number of ring
pages, as it may exceed the partial mapping. Doing so will yield an
-EFAULT from vm_insert_pages(), as we pass in more pages than what the
application asked for.

Cap the number of pages to match what the application asked for, for
the particular mapping operation.

Reported-by: default avatarLucas Mülling <lmulling@proton.me>
Link: https://github.com/axboe/liburing/issues/1157
Fixes: 3ab1db3c

 ("io_uring: get rid of remap_pfn_range() for mapping rings/sqes")
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 1613e604
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment