]> www.infradead.org Git - nvme.git/commit
io_uring: always do atomic put from iowq
authorPavel Begunkov <asml.silence@gmail.com>
Thu, 3 Apr 2025 11:29:30 +0000 (12:29 +0100)
committerJens Axboe <axboe@kernel.dk>
Thu, 3 Apr 2025 14:31:57 +0000 (08:31 -0600)
commit390513642ee6763c7ada07f0a1470474986e6c1c
treeb9ed41c998e188570d62ddfdced76327b56adba2
parent57ed58c1325690ff6a46da776e9b42b14a7c37b1
io_uring: always do atomic put from iowq

io_uring always switches requests to atomic refcounting for iowq
execution before there is any parallilism by setting REQ_F_REFCOUNT,
and the flag is not cleared until the request completes. That should be
fine as long as the compiler doesn't make up a non existing value for
the flags, however KCSAN still complains when the request owner changes
oter flag bits:

BUG: KCSAN: data-race in io_req_task_cancel / io_wq_free_work
...
read to 0xffff888117207448 of 8 bytes by task 3871 on cpu 0:
 req_ref_put_and_test io_uring/refs.h:22 [inline]

Skip REQ_F_REFCOUNT checks for iowq, we know it's set.

Reported-by: syzbot+903a2ad71fb3f1e47cf5@syzkaller.appspotmail.com
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/d880bc27fb8c3209b54641be4ff6ac02b0e5789a.1743679736.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/io_uring.c
io_uring/refs.h