• P
    io_uring: dont kill fasync under completion_lock · 4aa84f2f
    Pavel Begunkov 提交于
          CPU0                    CPU1
           ----                    ----
      lock(&new->fa_lock);
                                   local_irq_disable();
                                   lock(&ctx->completion_lock);
                                   lock(&new->fa_lock);
      <Interrupt>
        lock(&ctx->completion_lock);
    
     *** DEADLOCK ***
    
    Move kill_fasync() out of io_commit_cqring() to io_cqring_ev_posted(),
    so it doesn't hold completion_lock while doing it. That saves from the
    reported deadlock, and it's just nice to shorten the locking time and
    untangle nested locks (compl_lock -> wq_head::lock).
    
    Reported-by: syzbot+91ca3f25bd7f795f019c@syzkaller.appspotmail.com
    Signed-off-by: NPavel Begunkov <asml.silence@gmail.com>
    Signed-off-by: NJens Axboe <axboe@kernel.dk>
    4aa84f2f
io_uring.c 242.0 KB