]> git.baikalelectronics.ru Git - kernel.git/commit
io_uring: fix lockup with timeouts
authorPavel Begunkov <asml.silence@gmail.com>
Fri, 6 Mar 2020 22:15:22 +0000 (01:15 +0300)
committerJens Axboe <axboe@kernel.dk>
Sat, 7 Mar 2020 15:35:56 +0000 (08:35 -0700)
commit57ffe3564d43b0b01b9067be2c077cc9081bb4de
tree7dccd88cdb089208a69c95de6a3d11ed7737b057
parent38e3f7a2a7b5397ed44f896196d320600848f28f
io_uring: fix lockup with timeouts

There is a recipe to deadlock the kernel: submit a timeout sqe with a
linked_timeout (e.g.  test_single_link_timeout_ception() from liburing),
and SIGKILL the process.

Then, io_kill_timeouts() takes @ctx->completion_lock, but the timeout
isn't flagged with REQ_F_COMP_LOCKED, and will try to double grab it
during io_put_free() to cancel the linked timeout. Probably, the same
can happen with another io_kill_timeout() call site, that is
io_commit_cqring().

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c