summaryrefslogtreecommitdiff
path: root/include/linux/timerqueue.h
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2026-09-29 06:52:17 -0600
committerJens Axboe <axboe@kernel.dk>2026-09-29 06:52:39 -0600
commita92193c91e8839fe5fc209616ea95465ae4b919d (patch)
treededdbf9f6c02be3b595b86ca84fbed60cbce3681 /include/linux/timerqueue.h
parent3a3d93070c5ec8b8049d57025987ba313420bda9 (diff)
downloadlinux-next-a92193c91e8839fe5fc209616ea95465ae4b919d.tar.gz
linux-next-a92193c91e8839fe5fc209616ea95465ae4b919d.zip
io_uring: fix task_work add use-after-free with SQPOLL
For SQPOLL, the sqpoll thread runs task_work off its own list and doesn't need to be told about it, so it can pop and complete a request as soon as mpscq_push() has published it. If that was the last request holding the ring alive, io_ring_exit_work() then frees the ctx, stops the thread, and with it the tctx, while io_req_normal_work_add() is still looking at both after the push: BUG: KASAN: slab-use-after-free in io_req_normal_work_add+0x439/0x510 Read of size 4 at addr ff11000000ca0000 by task repro/55 (...) BUG: KASAN: slab-use-after-free in queue_work_on+0x25/0x70 Write of size 8 at addr ff11000000c3bd00 by task repro/55 Hold an RCU read lock across the add, like io_req_local_work_add() already does, and have io_ring_exit_work() wait for a grace period for SQPOLL rings as well before freeing the ctx. Reported-by: Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr> Link: https://lore.kernel.org/io-uring/20260924205056.3759980-2-Jeremy.Jean@oss.cyber.gouv.fr/ Fixes: af5d68f8892f ("io_uring/sqpoll: manage task_work privately") Cc: stable@vger.kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux/timerqueue.h')
0 files changed, 0 insertions, 0 deletions