Commit Graph

4 Commits

Author SHA1 Message Date
Jeff Moyer ee0b3d14b6 io_uring: manually fix compilation error
io_uring: manually fix compilation error

JIRA: https://issues.redhat.com/browse/RHEL-64867
Signed-off-by: Rado Vrbovsky <rvrbovsk@redhat.com>
2025-01-13 18:57:26 +00:00
Jeff Moyer cca5599fc7 io_uring: fix corner case forgetting to vunmap
JIRA: https://issues.redhat.com/browse/RHEL-64867

commit 43eef70e7e2ac74e7767731dd806720c7fb5e010
Author: Pavel Begunkov <asml.silence@gmail.com>
Date:   Mon Nov 25 23:10:31 2024 +0000

    io_uring: fix corner case forgetting to vunmap
    
    io_pages_unmap() is a bit tricky in trying to figure whether the pages
    were previously vmap'ed or not. In particular If there is juts one page
    it belives there is no need to vunmap. Paired io_pages_map(), however,
    could've failed io_mem_alloc_compound() and attempted to
    io_mem_alloc_single(), which does vmap, and that leads to unpaired vmap.
    
    The solution is to fail if io_mem_alloc_compound() can't allocate a
    single page. That's the easiest way to deal with it, and those two
    functions are getting removed soon, so no need to overcomplicate it.
    
    Cc: stable@vger.kernel.org
    Fixes: 3ab1db3c6039e ("io_uring: get rid of remap_pfn_range() for mapping rings/sqes")
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Link: https://lore.kernel.org/r/477e75a3907a2fe83249e49c0a92cd480b2c60e0.1732569842.git.asml.silence@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2024-12-02 14:44:24 -05:00
Jeff Moyer 96c545a697 io_uring: don't attempt to mmap larger than what the user asks for
JIRA: https://issues.redhat.com/browse/RHEL-64867

commit 06fe9b1df1086b42718d632aa57e8f7cd1a66a21
Author: Jens Axboe <axboe@kernel.dk>
Date:   Wed May 29 09:38:38 2024 -0600

    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: Lucas Mülling <lmulling@proton.me>
    Link: https://github.com/axboe/liburing/issues/1157
    Fixes: 3ab1db3c6039 ("io_uring: get rid of remap_pfn_range() for mapping rings/sqes")
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2024-12-02 11:12:47 -05:00
Jeff Moyer d45024afd9 io_uring: move mapping/allocation helpers to a separate file
JIRA: https://issues.redhat.com/browse/RHEL-64867
Conflicts: RHEL does not have commit 5e0a760b4441 ("mm, treewide:
rename MAX_ORDER to MAX_PAGE_ORDER").

commit f15ed8b4d0ce2c0831232ff85117418740f0c529
Author: Jens Axboe <axboe@kernel.dk>
Date:   Wed Mar 27 14:59:09 2024 -0600

    io_uring: move mapping/allocation helpers to a separate file
    
    Move the related code from io_uring.c into memmap.c. No functional
    changes in this patch, just cleaning it up a bit now that the full
    transition is done.
    
    Signed-off-by: Jens Axboe <axboe@kernel.dk>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
2024-11-28 17:09:44 -05:00