syzbot


possible deadlock in skb_queue_tail (3)

Status: auto-closed as invalid on 2022/08/04 19:39
Reported-by: syzbot+06d44206f34e058fe2a5@syzkaller.appspotmail.com
First crash: 495d, last: 233d
similar bugs (3):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in skb_queue_tail (2) 1 651d 647d 0/24 auto-closed as invalid on 2021/06/12 20:45
upstream possible deadlock in skb_queue_tail 33 1347d 1699d 0/24 auto-closed as invalid on 2019/09/16 10:00
upstream possible deadlock in skb_queue_tail (4) 2 61d 66d 0/24 upstream: reported on 2022/09/20 12:53

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
5.16.0-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.5/14544 is trying to acquire lock:
ffff88806cd489e8 (rlock-AF_UNIX){+.+.}-{2:2}, at: skb_queue_tail+0x21/0x140 net/core/skbuff.c:3341

but task is already holding lock:
ffff88806cd48e78 (&u->lock/1){+.+.}-{2:2}, at: unix_state_double_lock net/unix/af_unix.c:1276 [inline]
ffff88806cd48e78 (&u->lock/1){+.+.}-{2:2}, at: unix_state_double_lock+0x77/0xa0 net/unix/af_unix.c:1268

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&u->lock/1){+.+.}-{2:2}:
       _raw_spin_lock_nested+0x30/0x40 kernel/locking/spinlock.c:368
       sk_diag_dump_icons net/unix/diag.c:87 [inline]
       sk_diag_fill+0xaaf/0x10d0 net/unix/diag.c:155
       sk_diag_dump net/unix/diag.c:193 [inline]
       unix_diag_dump+0x3b9/0x620 net/unix/diag.c:221
       netlink_dump+0x4b2/0xb70 net/netlink/af_netlink.c:2268
       __netlink_dump_start+0x644/0x900 net/netlink/af_netlink.c:2373
       netlink_dump_start include/linux/netlink.h:254 [inline]
       unix_diag_handler_dump+0x43b/0x840 net/unix/diag.c:320
       __sock_diag_cmd net/core/sock_diag.c:235 [inline]
       sock_diag_rcv_msg+0x31a/0x440 net/core/sock_diag.c:266
       netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2494
       sock_diag_rcv+0x26/0x40 net/core/sock_diag.c:277
       netlink_unicast_kernel net/netlink/af_netlink.c:1317 [inline]
       netlink_unicast+0x539/0x7e0 net/netlink/af_netlink.c:1343
       netlink_sendmsg+0x904/0xe00 net/netlink/af_netlink.c:1919
       sock_sendmsg_nosec net/socket.c:705 [inline]
       sock_sendmsg+0xcf/0x120 net/socket.c:725
       sock_write_iter+0x289/0x3c0 net/socket.c:1061
       call_write_iter include/linux/fs.h:2086 [inline]
       do_iter_readv_writev+0x47a/0x750 fs/read_write.c:725
       do_iter_write+0x188/0x710 fs/read_write.c:851
       vfs_writev+0x1aa/0x630 fs/read_write.c:924
       do_writev+0x27f/0x300 fs/read_write.c:967
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x44/0xae

-> #0 (rlock-AF_UNIX){+.+.}-{2:2}:
       check_prev_add kernel/locking/lockdep.c:3063 [inline]
       check_prevs_add kernel/locking/lockdep.c:3186 [inline]
       validate_chain kernel/locking/lockdep.c:3801 [inline]
       __lock_acquire+0x2a2c/0x5470 kernel/locking/lockdep.c:5027
       lock_acquire kernel/locking/lockdep.c:5639 [inline]
       lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5604
       __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
       _raw_spin_lock_irqsave+0x39/0x50 kernel/locking/spinlock.c:162
       skb_queue_tail+0x21/0x140 net/core/skbuff.c:3341
       unix_dgram_sendmsg+0xeeb/0x1a10 net/unix/af_unix.c:2027
       sock_sendmsg_nosec net/socket.c:705 [inline]
       sock_sendmsg+0xcf/0x120 net/socket.c:725
       io_send+0x1bd/0x450 fs/io_uring.c:5000
       io_issue_sqe+0x374f/0x72e0 fs/io_uring.c:6733
       __io_queue_sqe fs/io_uring.c:7057 [inline]
       io_req_task_submit+0xce/0x530 fs/io_uring.c:2447
       io_apoll_task_func+0x1e6/0x250 fs/io_uring.c:5589
       handle_tw_list fs/io_uring.c:2334 [inline]
       tctx_task_work+0x19a/0xee0 fs/io_uring.c:2368
       task_work_run+0xdd/0x1a0 kernel/task_work.c:164
       tracehook_notify_signal include/linux/tracehook.h:213 [inline]
       handle_signal_work kernel/entry/common.c:146 [inline]
       exit_to_user_mode_loop kernel/entry/common.c:172 [inline]
       exit_to_user_mode_prepare+0x256/0x290 kernel/entry/common.c:207
       __syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline]
       syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:300
       do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86
       entry_SYSCALL_64_after_hwframe+0x44/0xae

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&u->lock/1);
                               lock(rlock-AF_UNIX);
                               lock(&u->lock/1);
  lock(rlock-AF_UNIX);

 *** DEADLOCK ***

2 locks held by syz-executor.5/14544:
 #0: ffff888049f060a8 (&ctx->uring_lock){+.+.}-{3:3}, at: handle_tw_list fs/io_uring.c:2331 [inline]
 #0: ffff888049f060a8 (&ctx->uring_lock){+.+.}-{3:3}, at: tctx_task_work+0x29f/0xee0 fs/io_uring.c:2368
 #1: ffff88806cd48e78 (&u->lock/1){+.+.}-{2:2}, at: unix_state_double_lock net/unix/af_unix.c:1276 [inline]
 #1: ffff88806cd48e78 (&u->lock/1){+.+.}-{2:2}, at: unix_state_double_lock+0x77/0xa0 net/unix/af_unix.c:1268

stack backtrace:
CPU: 1 PID: 14544 Comm: syz-executor.5 Not tainted 5.16.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
 check_noncircular+0x25f/0x2e0 kernel/locking/lockdep.c:2143
 check_prev_add kernel/locking/lockdep.c:3063 [inline]
 check_prevs_add kernel/locking/lockdep.c:3186 [inline]
 validate_chain kernel/locking/lockdep.c:3801 [inline]
 __lock_acquire+0x2a2c/0x5470 kernel/locking/lockdep.c:5027
 lock_acquire kernel/locking/lockdep.c:5639 [inline]
 lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5604
 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
 _raw_spin_lock_irqsave+0x39/0x50 kernel/locking/spinlock.c:162
 skb_queue_tail+0x21/0x140 net/core/skbuff.c:3341
 unix_dgram_sendmsg+0xeeb/0x1a10 net/unix/af_unix.c:2027
 sock_sendmsg_nosec net/socket.c:705 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:725
 io_send+0x1bd/0x450 fs/io_uring.c:5000
 io_issue_sqe+0x374f/0x72e0 fs/io_uring.c:6733
 __io_queue_sqe fs/io_uring.c:7057 [inline]
 io_req_task_submit+0xce/0x530 fs/io_uring.c:2447
 io_apoll_task_func+0x1e6/0x250 fs/io_uring.c:5589
 handle_tw_list fs/io_uring.c:2334 [inline]
 tctx_task_work+0x19a/0xee0 fs/io_uring.c:2368
 task_work_run+0xdd/0x1a0 kernel/task_work.c:164
 tracehook_notify_signal include/linux/tracehook.h:213 [inline]
 handle_signal_work kernel/entry/common.c:146 [inline]
 exit_to_user_mode_loop kernel/entry/common.c:172 [inline]
 exit_to_user_mode_prepare+0x256/0x290 kernel/entry/common.c:207
 __syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline]
 syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:300
 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7f7a5b01bfe9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f7a59991168 EFLAGS: 00000246 ORIG_RAX: 00000000000001aa
RAX: 0000000000000080 RBX: 00007f7a5b12ef60 RCX: 00007f7a5b01bfe9
RDX: 0000000000000000 RSI: 0000000000002a6e RDI: 0000000000000003
RBP: 00007f7a5b07608d R08: 0000000000000000 R09: 000000000000000e
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f7a5b662b1f R14: 00007f7a59991300 R15: 0000000000022000
 </TASK>

Crashes (4):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce 2022/01/20 15:37 upstream fa2e1ba3e9e3 b838eb76 .config log report info possible deadlock in skb_queue_tail
ci-upstream-kasan-gce-root 2021/11/02 05:36 upstream d2fac0afe89f 098b5d53 .config log report info possible deadlock in skb_queue_tail
ci-qemu-upstream 2021/07/18 16:33 upstream 1d67c8d993ba f115ae98 .config log report info possible deadlock in skb_queue_tail
ci-upstream-linux-next-kasan-gce-root 2022/04/06 19:38 linux-next 109f6d10ec17 97582466 .config log report info possible deadlock in skb_queue_tail
* Struck through repros no longer work on HEAD.