Skip to content
Snippets Groups Projects
  1. Feb 24, 2023
  2. Jan 29, 2023
  3. Jan 23, 2023
    • Jens Axboe's avatar
      io_uring/net: cache provided buffer group value for multishot receives · b00c51ef
      Jens Axboe authored
      
      If we're using ring provided buffers with multishot receive, and we end
      up doing an io-wq based issue at some points that also needs to select
      a buffer, we'll lose the initially assigned buffer group as
      io_ring_buffer_select() correctly clears the buffer group list as the
      issue isn't serialized by the ctx uring_lock. This is fine for normal
      receives as the request puts the buffer and finishes, but for multishot,
      we will re-arm and do further receives. On the next trigger for this
      multishot receive, the receive will try and pick from a buffer group
      whose value is the same as the buffer ID of the las receive. That is
      obviously incorrect, and will result in a premature -ENOUFS error for
      the receive even if we had available buffers in the correct group.
      
      Cache the buffer group value at prep time, so we can restore it for
      future receives. This only needs doing for the above mentioned case, but
      just do it by default to keep it easier to read.
      
      Cc: stable@vger.kernel.org
      Fixes: b3fdea6e ("io_uring: multishot recv")
      Fixes: 9bb66906 ("io_uring: support multishot in recvmsg")
      Cc: Dylan Yudaken <dylany@meta.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      b00c51ef
  4. Jan 09, 2023
  5. Dec 19, 2022
  6. Dec 07, 2022
  7. Nov 25, 2022
  8. Nov 21, 2022
  9. Nov 17, 2022
  10. Oct 22, 2022
  11. Oct 13, 2022
  12. Sep 30, 2022
  13. Sep 29, 2022
  14. Sep 28, 2022
  15. Sep 26, 2022
  16. Sep 23, 2022
    • Pavel Begunkov's avatar
      io_uring/net: fix UAF in io_sendrecv_fail() · a75155fa
      Pavel Begunkov authored
      
      We should not assume anything about ->free_iov just from
      REQ_F_ASYNC_DATA but rather rely on REQ_F_NEED_CLEANUP, as we may
      allocate ->async_data but failed init would leave the field in not
      consistent state. The easiest solution is to remove removing
      REQ_F_NEED_CLEANUP and so ->async_data dealloc from io_sendrecv_fail()
      and let io_send_zc_cleanup() do the job. The catch here is that we also
      need to prevent double notif flushing, just test it for NULL and zero
      where it's needed.
      
      BUG: KASAN: use-after-free in io_sendrecv_fail+0x3b0/0x3e0 io_uring/net.c:1221
      Write of size 8 at addr ffff8880771b4080 by task syz-executor.3/30199
      
      CPU: 1 PID: 30199 Comm: syz-executor.3 Not tainted 6.0.0-rc6-next-20220923-syzkaller #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/26/2022
      Call Trace:
       <TASK>
       __dump_stack lib/dump_stack.c:88 [inline]
       dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
       print_address_description mm/kasan/report.c:284 [inline]
       print_report+0x15e/0x45d mm/kasan/report.c:395
       kasan_report+0xbb/0x1f0 mm/kasan/report.c:495
       io_sendrecv_fail+0x3b0/0x3e0 io_uring/net.c:1221
       io_req_complete_failed+0x155/0x1b0 io_uring/io_uring.c:873
       io_drain_req io_uring/io_uring.c:1648 [inline]
       io_queue_sqe_fallback.cold+0x29f/0x788 io_uring/io_uring.c:1931
       io_submit_sqe io_uring/io_uring.c:2160 [inline]
       io_submit_sqes+0x1180/0x1df0 io_uring/io_uring.c:2276
       __do_sys_io_uring_enter+0xac6/0x2410 io_uring/io_uring.c:3216
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd
      
      Fixes: c4c0009e ("io_uring/net: combine fail handlers")
      Reported-by: default avatar <syzbot+4c597a574a3f5a251bda@syzkaller.appspotmail.com>
      Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
      Link: https://lore.kernel.org/r/23ab8346e407ea50b1198a172c8a97e1cf22915b.1663945875.git.asml.silence@gmail.com
      
      
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      a75155fa
  17. Sep 21, 2022
Loading