syzbot


possible deadlock in skb_queue_tail (5)

Status: upstream: reported on 2023/02/03 12:29
Labels: net (incorrect?)
Reported-by: syzbot+99002eea79449bad3ce2@syzkaller.appspotmail.com
First crash: 121d, last: 38d
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] possible deadlock in skb_queue_tail (5) 0 (1) 2023/02/03 12:29
Similar bugs (5)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in skb_queue_tail (3) 4 420d 678d 0/24 auto-closed as invalid on 2022/08/04 19:39
linux-5.15 possible deadlock in skb_queue_tail 1 27d 27d 0/3 upstream: reported on 2023/05/04 06:07
upstream possible deadlock in skb_queue_tail (2) 1 838d 834d 0/24 auto-closed as invalid on 2021/06/12 20:45
upstream possible deadlock in skb_queue_tail 33 1533d 1885d 0/24 auto-closed as invalid on 2019/09/16 10:00
upstream possible deadlock in skb_queue_tail (4) 2 248d 253d 0/24 auto-obsoleted due to no activity on 2023/01/23 13:03

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.3.0-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.4/27739 is trying to acquire lock:
ffff888077b521e8 (rlock-AF_UNIX){+.+.}-{2:2}, at: skb_queue_tail+0x36/0x120 net/core/skbuff.c:3683

but task is already holding lock:
ffff888077b52680 (&u->lock/1){+.+.}-{2:2}, at: unix_dgram_sendmsg+0xefe/0x2050 net/unix/af_unix.c:2059

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&u->lock/1){+.+.}-{2:2}:
       lock_acquire+0x1e1/0x520 kernel/locking/lockdep.c:5669
       _raw_spin_lock_nested+0x31/0x40 kernel/locking/spinlock.c:378
       sk_diag_dump_icons net/unix/diag.c:87 [inline]
       sk_diag_fill+0x6ea/0xfe0 net/unix/diag.c:157
       sk_diag_dump net/unix/diag.c:196 [inline]
       unix_diag_dump+0x3eb/0x640 net/unix/diag.c:220
       netlink_dump+0x656/0xcc0 net/netlink/af_netlink.c:2299
       __netlink_dump_start+0x536/0x700 net/netlink/af_netlink.c:2404
       netlink_dump_start include/linux/netlink.h:308 [inline]
       unix_diag_handler_dump+0x1c0/0x8e0 net/unix/diag.c:319
       sock_diag_rcv_msg+0xe3/0x400
       netlink_rcv_skb+0x1df/0x430 net/netlink/af_netlink.c:2577
       sock_diag_rcv+0x2a/0x40 net/core/sock_diag.c:280
       netlink_unicast_kernel net/netlink/af_netlink.c:1339 [inline]
       netlink_unicast+0x7c3/0x990 net/netlink/af_netlink.c:1365
       netlink_sendmsg+0xa2a/0xd60 net/netlink/af_netlink.c:1942
       sock_sendmsg_nosec net/socket.c:724 [inline]
       sock_sendmsg net/socket.c:747 [inline]
       sock_write_iter+0x397/0x520 net/socket.c:1138
       do_iter_write+0x6ea/0xc50 fs/read_write.c:861
       vfs_writev fs/read_write.c:934 [inline]
       do_writev+0x27f/0x470 fs/read_write.c:977
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

-> #0 (rlock-AF_UNIX){+.+.}-{2:2}:
       check_prev_add kernel/locking/lockdep.c:3098 [inline]
       check_prevs_add kernel/locking/lockdep.c:3217 [inline]
       validate_chain+0x166b/0x58e0 kernel/locking/lockdep.c:3832
       __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5056
       lock_acquire+0x1e1/0x520 kernel/locking/lockdep.c:5669
       __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
       _raw_spin_lock_irqsave+0xd5/0x120 kernel/locking/spinlock.c:162
       skb_queue_tail+0x36/0x120 net/core/skbuff.c:3683
       unix_dgram_sendmsg+0x1502/0x2050 net/unix/af_unix.c:2082
       sock_sendmsg_nosec net/socket.c:724 [inline]
       sock_sendmsg net/socket.c:747 [inline]
       ____sys_sendmsg+0x58f/0x890 net/socket.c:2501
       ___sys_sendmsg net/socket.c:2555 [inline]
       __sys_sendmmsg+0x3af/0x730 net/socket.c:2641
       __do_sys_sendmmsg net/socket.c:2670 [inline]
       __se_sys_sendmmsg net/socket.c:2667 [inline]
       __x64_sys_sendmmsg+0xa0/0xb0 net/socket.c:2667
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

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 ***

1 lock held by syz-executor.4/27739:
 #0: ffff888077b52680 (&u->lock/1){+.+.}-{2:2}, at: unix_dgram_sendmsg+0xefe/0x2050 net/unix/af_unix.c:2059

stack backtrace:
CPU: 1 PID: 27739 Comm: syz-executor.4 Not tainted 6.3.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/14/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106
 check_noncircular+0x2fe/0x3b0 kernel/locking/lockdep.c:2178
 check_prev_add kernel/locking/lockdep.c:3098 [inline]
 check_prevs_add kernel/locking/lockdep.c:3217 [inline]
 validate_chain+0x166b/0x58e0 kernel/locking/lockdep.c:3832
 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5056
 lock_acquire+0x1e1/0x520 kernel/locking/lockdep.c:5669
 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
 _raw_spin_lock_irqsave+0xd5/0x120 kernel/locking/spinlock.c:162
 skb_queue_tail+0x36/0x120 net/core/skbuff.c:3683
 unix_dgram_sendmsg+0x1502/0x2050 net/unix/af_unix.c:2082
 sock_sendmsg_nosec net/socket.c:724 [inline]
 sock_sendmsg net/socket.c:747 [inline]
 ____sys_sendmsg+0x58f/0x890 net/socket.c:2501
 ___sys_sendmsg net/socket.c:2555 [inline]
 __sys_sendmmsg+0x3af/0x730 net/socket.c:2641
 __do_sys_sendmmsg net/socket.c:2670 [inline]
 __se_sys_sendmmsg net/socket.c:2667 [inline]
 __x64_sys_sendmmsg+0xa0/0xb0 net/socket.c:2667
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f6d5108c169
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 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 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f6d51e01168 EFLAGS: 00000246 ORIG_RAX: 0000000000000133
RAX: ffffffffffffffda RBX: 00007f6d511ac120 RCX: 00007f6d5108c169
RDX: 0000000000000001 RSI: 0000000020002180 RDI: 0000000000000004
RBP: 00007f6d510e7ca1 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000020004050 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fff59b4654f R14: 00007f6d51e01300 R15: 0000000000022000
 </TASK>

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Manager Title
2023/04/24 00:08 upstream 457391b03803 2b32bd34 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in skb_queue_tail
2023/02/02 19:26 upstream 9f266ccaa2f5 16d19e30 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in skb_queue_tail
2023/03/23 02:54 upstream fff5a5e7f528 f94b4a29 .config console log report info ci-qemu-upstream-386 possible deadlock in skb_queue_tail
2023/01/30 12:26 upstream 6d796c50f84c 7374c4e5 .config console log report info ci-qemu-upstream-386 possible deadlock in skb_queue_tail
* Struck through repros no longer work on HEAD.