• Jens Axboe's avatar
    io_uring: don't recurse on tsk->sighand->siglock with signalfd · b7e397bc
    Jens Axboe authored
    [ Upstream commit fd7d6de2
    
     ]
    
    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: default avatarJens Axboe <axboe@kernel.dk>
    Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
    b7e397bc
io_uring.c 200 KB