]> www.infradead.org Git - users/willy/xarray.git/commitdiff
io_uring/sqpoll: annotate debug task == current with data_race()
authorJens Axboe <axboe@kernel.dk>
Tue, 13 Aug 2024 12:10:59 +0000 (06:10 -0600)
committerJens Axboe <axboe@kernel.dk>
Tue, 13 Aug 2024 12:10:59 +0000 (06:10 -0600)
There's a debug check in io_sq_thread_park() checking if it's the SQPOLL
thread itself calling park. KCSAN warns about this, as we should not be
reading sqd->thread outside of sqd->lock.

Just silence this with data_race(). The pointer isn't used for anything
but this debug check.

Reported-by: syzbot+2b946a3fd80caf971b21@syzkaller.appspotmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/sqpoll.c

index b3722e5275e77e632529dedfb4285f3adfa07537..3b50dc9586d14fcb6a6b16e9fe29d029c86b15bc 100644 (file)
@@ -44,7 +44,7 @@ void io_sq_thread_unpark(struct io_sq_data *sqd)
 void io_sq_thread_park(struct io_sq_data *sqd)
        __acquires(&sqd->lock)
 {
-       WARN_ON_ONCE(sqd->thread == current);
+       WARN_ON_ONCE(data_race(sqd->thread) == current);
 
        atomic_inc(&sqd->park_pending);
        set_bit(IO_SQ_THREAD_SHOULD_PARK, &sqd->state);