io_uring/kbuf: disallow mapping a badly aligned provided ring buffer
authorJens Axboe <axboe@kernel.dk>
Fri, 17 Mar 2023 16:42:08 +0000 (10:42 -0600)
committerJens Axboe <axboe@kernel.dk>
Mon, 3 Apr 2023 13:16:14 +0000 (07:16 -0600)
commitfcb46c0ccc7c07af54f818fd498e461353ea50e7
tree8053256e7e48f16be068cbfa3ef46ff06b885686
parente1fe7ee885dc0712e982ee465d9f8b96254c30c1
io_uring/kbuf: disallow mapping a badly aligned provided ring buffer

On at least parisc, we have strict requirements on how we virtually map
an address that is shared between the application and the kernel. On
these platforms, IOU_PBUF_RING_MMAP should be used when setting up a
shared ring buffer for provided buffers. If the application is mapping
these pages and asking the kernel to pin+map them as well, then we have
no control over what virtual address we get in the kernel.

For that case, do a sanity check if SHM_COLOUR is defined, and disallow
the mapping request. The application must fall back to using
IOU_PBUF_RING_MMAP for this case, and liburing will do that transparently
with the set of helpers that it has.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/kbuf.c