possible deadlock in io_uring_show_fdinfo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

syzbot found the following issue on:

HEAD commit:    fb0155a0 Merge tag 'nfs-for-5.9-3' of git://git.linux-nfs...
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=109bf9e3900000
kernel config:  https://syzkaller.appspot.com/x/.config?x=adebb40048274f92
dashboard link: https://syzkaller.appspot.com/bug?extid=d8076141c9af9baf6304
compiler:       clang version 10.0.0 (https://github.com/llvm/llvm-project/ c2443155a0fb245c8f17f2c1c72b6ea391e86e81)

Unfortunately, I don't have any reproducer for this issue yet.

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+d8076141c9af9baf6304@xxxxxxxxxxxxxxxxxxxxxxxxx

======================================================
WARNING: possible circular locking dependency detected
5.9.0-rc7-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.3/10475 is trying to acquire lock:
ffff8880a1a23428 (&ctx->uring_lock){+.+.}-{3:3}, at: __io_uring_show_fdinfo fs/io_uring.c:8417 [inline]
ffff8880a1a23428 (&ctx->uring_lock){+.+.}-{3:3}, at: io_uring_show_fdinfo+0x6c/0x790 fs/io_uring.c:8460

but task is already holding lock:
ffff888089039668 (&p->lock){+.+.}-{3:3}, at: seq_read+0x60/0xce0 fs/seq_file.c:155

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&p->lock){+.+.}-{3:3}:
       lock_acquire+0x148/0x720 kernel/locking/lockdep.c:5029
       __mutex_lock_common+0x189/0x2fc0 kernel/locking/mutex.c:956
       __mutex_lock kernel/locking/mutex.c:1103 [inline]
       mutex_lock_nested+0x1a/0x20 kernel/locking/mutex.c:1118
       seq_read+0x60/0xce0 fs/seq_file.c:155
       do_loop_readv_writev fs/read_write.c:734 [inline]
       do_iter_read+0x438/0x620 fs/read_write.c:955
       vfs_readv+0xc2/0x120 fs/read_write.c:1073
       kernel_readv fs/splice.c:355 [inline]
       default_file_splice_read+0x579/0xa40 fs/splice.c:412
       do_splice_to fs/splice.c:871 [inline]
       splice_direct_to_actor+0x3de/0xb60 fs/splice.c:950
       do_splice_direct+0x201/0x340 fs/splice.c:1059
       do_sendfile+0x86d/0x1210 fs/read_write.c:1540
       __do_sys_sendfile64 fs/read_write.c:1601 [inline]
       __se_sys_sendfile64 fs/read_write.c:1587 [inline]
       __x64_sys_sendfile64+0x164/0x1a0 fs/read_write.c:1587
       do_syscall_64+0x31/0x70 arch/x86/entry/common.c:46
       entry_SYSCALL_64_after_hwframe+0x44/0xa9

-> #1 (sb_writers#4){.+.+}-{0:0}:
       lock_acquire+0x148/0x720 kernel/locking/lockdep.c:5029
       percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
       __sb_start_write+0x14b/0x400 fs/super.c:1672
       io_write+0x50f/0x1230 fs/io_uring.c:3294
       io_issue_sqe+0x34fe/0xc1a0 fs/io_uring.c:5722
       __io_queue_sqe+0x297/0x1310 fs/io_uring.c:6178
       io_submit_sqe fs/io_uring.c:6327 [inline]
       io_submit_sqes+0x149f/0x2570 fs/io_uring.c:6521
       __do_sys_io_uring_enter fs/io_uring.c:8349 [inline]
       __se_sys_io_uring_enter+0x1af/0x1300 fs/io_uring.c:8308
       do_syscall_64+0x31/0x70 arch/x86/entry/common.c:46
       entry_SYSCALL_64_after_hwframe+0x44/0xa9

-> #0 (&ctx->uring_lock){+.+.}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:2496 [inline]
       check_prevs_add kernel/locking/lockdep.c:2601 [inline]
       validate_chain+0x1b0c/0x88a0 kernel/locking/lockdep.c:3218
       __lock_acquire+0x110b/0x2ae0 kernel/locking/lockdep.c:4441
       lock_acquire+0x148/0x720 kernel/locking/lockdep.c:5029
       __mutex_lock_common+0x189/0x2fc0 kernel/locking/mutex.c:956
       __mutex_lock kernel/locking/mutex.c:1103 [inline]
       mutex_lock_nested+0x1a/0x20 kernel/locking/mutex.c:1118
       __io_uring_show_fdinfo fs/io_uring.c:8417 [inline]
       io_uring_show_fdinfo+0x6c/0x790 fs/io_uring.c:8460
       seq_show+0x567/0x620 fs/proc/fd.c:65
       seq_read+0x41a/0xce0 fs/seq_file.c:208
       do_loop_readv_writev fs/read_write.c:734 [inline]
       do_iter_read+0x438/0x620 fs/read_write.c:955
       vfs_readv+0xc2/0x120 fs/read_write.c:1073
       kernel_readv fs/splice.c:355 [inline]
       default_file_splice_read+0x579/0xa40 fs/splice.c:412
       do_splice_to fs/splice.c:871 [inline]
       splice_direct_to_actor+0x3de/0xb60 fs/splice.c:950
       do_splice_direct+0x201/0x340 fs/splice.c:1059
       do_sendfile+0x86d/0x1210 fs/read_write.c:1540
       __do_sys_sendfile64 fs/read_write.c:1601 [inline]
       __se_sys_sendfile64 fs/read_write.c:1587 [inline]
       __x64_sys_sendfile64+0x164/0x1a0 fs/read_write.c:1587
       do_syscall_64+0x31/0x70 arch/x86/entry/common.c:46
       entry_SYSCALL_64_after_hwframe+0x44/0xa9

other info that might help us debug this:

Chain exists of:
  &ctx->uring_lock --> sb_writers#4 --> &p->lock

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&p->lock);
                               lock(sb_writers#4);
                               lock(&p->lock);
  lock(&ctx->uring_lock);

 *** DEADLOCK ***

2 locks held by syz-executor.3/10475:
 #0: ffff88821407a450 (sb_writers#4){.+.+}-{0:0}, at: file_start_write include/linux/fs.h:2783 [inline]
 #0: ffff88821407a450 (sb_writers#4){.+.+}-{0:0}, at: do_sendfile+0x83b/0x1210 fs/read_write.c:1539
 #1: ffff888089039668 (&p->lock){+.+.}-{3:3}, at: seq_read+0x60/0xce0 fs/seq_file.c:155

stack backtrace:
CPU: 0 PID: 10475 Comm: syz-executor.3 Not tainted 5.9.0-rc7-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1d6/0x29e lib/dump_stack.c:118
 print_circular_bug+0xc72/0xea0 kernel/locking/lockdep.c:1703
 check_noncircular+0x1fb/0x3a0 kernel/locking/lockdep.c:1827
 check_prev_add kernel/locking/lockdep.c:2496 [inline]
 check_prevs_add kernel/locking/lockdep.c:2601 [inline]
 validate_chain+0x1b0c/0x88a0 kernel/locking/lockdep.c:3218
 __lock_acquire+0x110b/0x2ae0 kernel/locking/lockdep.c:4441
 lock_acquire+0x148/0x720 kernel/locking/lockdep.c:5029
 __mutex_lock_common+0x189/0x2fc0 kernel/locking/mutex.c:956
 __mutex_lock kernel/locking/mutex.c:1103 [inline]
 mutex_lock_nested+0x1a/0x20 kernel/locking/mutex.c:1118
 __io_uring_show_fdinfo fs/io_uring.c:8417 [inline]
 io_uring_show_fdinfo+0x6c/0x790 fs/io_uring.c:8460
 seq_show+0x567/0x620 fs/proc/fd.c:65
 seq_read+0x41a/0xce0 fs/seq_file.c:208
 do_loop_readv_writev fs/read_write.c:734 [inline]
 do_iter_read+0x438/0x620 fs/read_write.c:955
 vfs_readv+0xc2/0x120 fs/read_write.c:1073
 kernel_readv fs/splice.c:355 [inline]
 default_file_splice_read+0x579/0xa40 fs/splice.c:412
 do_splice_to fs/splice.c:871 [inline]
 splice_direct_to_actor+0x3de/0xb60 fs/splice.c:950
 do_splice_direct+0x201/0x340 fs/splice.c:1059
 do_sendfile+0x86d/0x1210 fs/read_write.c:1540
 __do_sys_sendfile64 fs/read_write.c:1601 [inline]
 __se_sys_sendfile64 fs/read_write.c:1587 [inline]
 __x64_sys_sendfile64+0x164/0x1a0 fs/read_write.c:1587
 do_syscall_64+0x31/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x45dd99
Code: 0d b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 db b3 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f3edfb2ec78 EFLAGS: 00000246 ORIG_RAX: 0000000000000028
RAX: ffffffffffffffda RBX: 0000000000027ec0 RCX: 000000000045dd99
RDX: 0000000000000000 RSI: 0000000000000009 RDI: 000000000000000a
RBP: 000000000118bf68 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000208 R11: 0000000000000246 R12: 000000000118bf2c
R13: 00007ffe7ad0078f R14: 00007f3edfb2f9c0 R15: 000000000118bf2c


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@xxxxxxxxxxxxxxxx.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux