]> git.ipfire.org Git - people/arne_f/kernel.git/commit
io_uring: don't recurse on tsk->sighand->siglock with signalfd
authorJens Axboe <axboe@kernel.dk>
Sun, 23 Aug 2020 17:00:37 +0000 (11:00 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Sep 2020 09:29:50 +0000 (11:29 +0200)
commitb7e397bcba0a0f8cc7aee8c8d9b5aa9a82c4fbe7
tree4c478e6ba50c7554d80c91e935918fa60285f363
parentb727b92fd33b7d09b986cfb043d71a47ae362633
io_uring: don't recurse on tsk->sighand->siglock with signalfd

[ Upstream commit fd7d6de2241453fc7d042336d366a939a25bc5a9 ]

If an application is doing reads on signalfd, and we arm the poll handler
because there's no data available, then the wakeup can recurse on the
tasks sighand->siglock as the signal delivery from task_work_add() will
use TWA_SIGNAL and that attempts to lock it again.

We can detect the signalfd case pretty easily by comparing the poll->head
wait_queue_head_t with the target task signalfd wait queue. Just use
normal task wakeup for this case.

Cc: stable@vger.kernel.org # v5.7+
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/io_uring.c