syzbot


possible deadlock in sk_diag_fill

Status: auto-closed as invalid on 2019/10/25 08:39
Subsystems: net
[Documentation on labels]
Reported-by: syzbot+c1872be62e587eae9669@syzkaller.appspotmail.com
First crash: 2352d, last: 1973d
Discussions (3)
Title Replies (including bot) Last reply
Reminder: 99 open syzbot bugs in net subsystem 14 (14) 2019/07/31 15:13
Reminder: 94 open syzbot bugs in net subsystem 1 (1) 2019/06/25 05:48
possible deadlock in sk_diag_fill 6 (7) 2018/05/15 07:26
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in sk_diag_fill (2) net 1 1616d 1615d 0/28 auto-closed as invalid on 2020/09/07 16:12
upstream possible deadlock in sk_diag_fill (3) net 8 948d 1156d 0/28 auto-closed as invalid on 2022/07/08 00:43
upstream possible deadlock in sk_diag_fill (4) net 1 799d 795d 0/28 auto-obsoleted due to no activity on 2022/10/04 20:15
upstream possible deadlock in sk_diag_fill (5) net 9 555d 493d 0/28 auto-obsoleted due to no activity on 2023/08/04 21:19

Sample crash report:
dccp_close: ABORT with 390 bytes unread

======================================================
WARNING: possible circular locking dependency detected
4.18.0-rc5+ #154 Not tainted
------------------------------------------------------
syz-executor2/5596 is trying to acquire lock:
0000000053ff80f6 (&(&u->lock)->rlock/1){+.+.}, at: sk_diag_dump_icons net/unix/diag.c:82 [inline]
0000000053ff80f6 (&(&u->lock)->rlock/1){+.+.}, at: sk_diag_fill.isra.5+0xa57/0x10f0 net/unix/diag.c:144

but task is already holding lock:
00000000b2346253 (rlock-AF_UNIX){+.+.}, at: spin_lock include/linux/spinlock.h:310 [inline]
00000000b2346253 (rlock-AF_UNIX){+.+.}, at: sk_diag_dump_icons net/unix/diag.c:64 [inline]
00000000b2346253 (rlock-AF_UNIX){+.+.}, at: sk_diag_fill.isra.5+0x962/0x10f0 net/unix/diag.c:144

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (rlock-AF_UNIX){+.+.}:
       __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
       _raw_spin_lock_irqsave+0x96/0xc0 kernel/locking/spinlock.c:152
       skb_queue_tail+0x26/0x150 net/core/skbuff.c:2916
       unix_dgram_sendmsg+0xfa2/0x1750 net/unix/af_unix.c:1797
       sock_sendmsg_nosec net/socket.c:641 [inline]
       sock_sendmsg+0xd5/0x120 net/socket.c:651
       ___sys_sendmsg+0x51d/0x930 net/socket.c:2125
       __sys_sendmmsg+0x240/0x6f0 net/socket.c:2220
       __do_sys_sendmmsg net/socket.c:2249 [inline]
       __se_sys_sendmmsg net/socket.c:2246 [inline]
       __x64_sys_sendmmsg+0x9d/0x100 net/socket.c:2246
       do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

-> #0 (&(&u->lock)->rlock/1){+.+.}:
       lock_acquire+0x1e4/0x540 kernel/locking/lockdep.c:3924
       _raw_spin_lock_nested+0x28/0x40 kernel/locking/spinlock.c:354
       sk_diag_dump_icons net/unix/diag.c:82 [inline]
       sk_diag_fill.isra.5+0xa57/0x10f0 net/unix/diag.c:144
       sk_diag_dump net/unix/diag.c:178 [inline]
       unix_diag_dump+0x35f/0x550 net/unix/diag.c:206
       netlink_dump+0x519/0xd50 net/netlink/af_netlink.c:2226
       __netlink_dump_start+0x51a/0x780 net/netlink/af_netlink.c:2323
       netlink_dump_start include/linux/netlink.h:214 [inline]
       unix_diag_handler_dump+0x3fc/0x7d0 net/unix/diag.c:307
       __sock_diag_cmd net/core/sock_diag.c:230 [inline]
       sock_diag_rcv_msg+0x2e0/0x3d0 net/core/sock_diag.c:261
       netlink_rcv_skb+0x172/0x440 net/netlink/af_netlink.c:2448
       sock_diag_rcv+0x2a/0x40 net/core/sock_diag.c:272
       netlink_unicast_kernel net/netlink/af_netlink.c:1310 [inline]
       netlink_unicast+0x5a0/0x760 net/netlink/af_netlink.c:1336
       netlink_sendmsg+0xa18/0xfd0 net/netlink/af_netlink.c:1901
       sock_sendmsg_nosec net/socket.c:641 [inline]
       sock_sendmsg+0xd5/0x120 net/socket.c:651
       sock_write_iter+0x362/0x5c0 net/socket.c:920
       call_write_iter include/linux/fs.h:1793 [inline]
       do_iter_readv_writev+0x897/0xa90 fs/read_write.c:680
       do_iter_write+0x185/0x5f0 fs/read_write.c:959
       vfs_writev+0x1f1/0x360 fs/read_write.c:1004
       do_writev+0x11a/0x310 fs/read_write.c:1039
       __do_sys_writev fs/read_write.c:1112 [inline]
       __se_sys_writev fs/read_write.c:1109 [inline]
       __x64_sys_writev+0x75/0xb0 fs/read_write.c:1109
       do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

other info that might help us debug this:

 Possible unsafe locking scenario:

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

 *** DEADLOCK ***

5 locks held by syz-executor2/5596:
 #0: 0000000024732816 (sock_diag_mutex){+.+.}, at: sock_diag_rcv+0x1b/0x40 net/core/sock_diag.c:271
 #1: 00000000f3c4b570 (sock_diag_table_mutex){+.+.}, at: __sock_diag_cmd net/core/sock_diag.c:225 [inline]
 #1: 00000000f3c4b570 (sock_diag_table_mutex){+.+.}, at: sock_diag_rcv_msg+0x169/0x3d0 net/core/sock_diag.c:261
 #2: 0000000072846eb5 (nlk_cb_mutex-SOCK_DIAG){+.+.}, at: netlink_dump+0x9f/0xd50 net/netlink/af_netlink.c:2182
 #3: 00000000fc568aee (unix_table_lock){+.+.}, at: spin_lock include/linux/spinlock.h:310 [inline]
 #3: 00000000fc568aee (unix_table_lock){+.+.}, at: unix_diag_dump+0x10a/0x550 net/unix/diag.c:192
 #4: 00000000b2346253 (rlock-AF_UNIX){+.+.}, at: spin_lock include/linux/spinlock.h:310 [inline]
 #4: 00000000b2346253 (rlock-AF_UNIX){+.+.}, at: sk_diag_dump_icons net/unix/diag.c:64 [inline]
 #4: 00000000b2346253 (rlock-AF_UNIX){+.+.}, at: sk_diag_fill.isra.5+0x962/0x10f0 net/unix/diag.c:144

stack backtrace:
CPU: 1 PID: 5596 Comm: syz-executor2 Not tainted 4.18.0-rc5+ #154
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+0x1c9/0x2b4 lib/dump_stack.c:113
 print_circular_bug.isra.36.cold.57+0x1bd/0x27d kernel/locking/lockdep.c:1227
 check_prev_add kernel/locking/lockdep.c:1867 [inline]
 check_prevs_add kernel/locking/lockdep.c:1980 [inline]
 validate_chain kernel/locking/lockdep.c:2421 [inline]
 __lock_acquire+0x3449/0x5020 kernel/locking/lockdep.c:3435
 lock_acquire+0x1e4/0x540 kernel/locking/lockdep.c:3924
 _raw_spin_lock_nested+0x28/0x40 kernel/locking/spinlock.c:354
 sk_diag_dump_icons net/unix/diag.c:82 [inline]
 sk_diag_fill.isra.5+0xa57/0x10f0 net/unix/diag.c:144
 sk_diag_dump net/unix/diag.c:178 [inline]
 unix_diag_dump+0x35f/0x550 net/unix/diag.c:206
 netlink_dump+0x519/0xd50 net/netlink/af_netlink.c:2226
 __netlink_dump_start+0x51a/0x780 net/netlink/af_netlink.c:2323
 netlink_dump_start include/linux/netlink.h:214 [inline]
 unix_diag_handler_dump+0x3fc/0x7d0 net/unix/diag.c:307
 __sock_diag_cmd net/core/sock_diag.c:230 [inline]
 sock_diag_rcv_msg+0x2e0/0x3d0 net/core/sock_diag.c:261
 netlink_rcv_skb+0x172/0x440 net/netlink/af_netlink.c:2448
 sock_diag_rcv+0x2a/0x40 net/core/sock_diag.c:272
 netlink_unicast_kernel net/netlink/af_netlink.c:1310 [inline]
 netlink_unicast+0x5a0/0x760 net/netlink/af_netlink.c:1336
 netlink_sendmsg+0xa18/0xfd0 net/netlink/af_netlink.c:1901
 sock_sendmsg_nosec net/socket.c:641 [inline]
 sock_sendmsg+0xd5/0x120 net/socket.c:651
 sock_write_iter+0x362/0x5c0 net/socket.c:920
 call_write_iter include/linux/fs.h:1793 [inline]
 do_iter_readv_writev+0x897/0xa90 fs/read_write.c:680
 do_iter_write+0x185/0x5f0 fs/read_write.c:959
 vfs_writev+0x1f1/0x360 fs/read_write.c:1004
 do_writev+0x11a/0x310 fs/read_write.c:1039
 __do_sys_writev fs/read_write.c:1112 [inline]
 __se_sys_writev fs/read_write.c:1109 [inline]
 __x64_sys_writev+0x75/0xb0 fs/read_write.c:1109
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x455ab9
Code: 1d ba 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 eb b9 fb ff c3 66 2e 0f 1f 84 00 00 00 00 
RSP: 002b:00007fe669b1cc68 EFLAGS: 00000246 ORIG_RAX: 0000000000000014
RAX: ffffffffffffffda RBX: 00007fe669b1d6d4 RCX: 0000000000455ab9
RDX: 0000000000000001 RSI: 00000000200000c0 RDI: 0000000000000015
RBP: 000000000072bea0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
R13: 00000000004c095e R14: 00000000004d4de8 R15: 0000000000000000

Crashes (30):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/07/19 23:02 upstream 024ddc0ce104 49f35839 .config console log report ci-upstream-kasan-gce
2018/07/06 05:53 upstream c42c12a90545 d3b2a0e2 .config console log report ci-upstream-kasan-gce-root
2018/07/03 23:14 upstream 410da1e12ffe 317fc8ea .config console log report ci-upstream-kasan-gce-root
2019/05/19 14:59 upstream 72cf0b07418a 5a4461b0 .config console log report ci-upstream-kasan-gce-386
2018/07/19 12:06 upstream 024ddc0ce104 49f35839 .config console log report ci-upstream-kasan-gce-386
2018/07/16 11:03 upstream 9d3cce1e8b85 92a49505 .config console log report ci-upstream-kasan-gce-386
2018/07/04 01:39 upstream 410da1e12ffe 317fc8ea .config console log report ci-upstream-kasan-gce-386
2018/05/25 10:01 upstream b50694381cfc f48c20b8 .config console log report ci-upstream-kasan-gce-386
2018/05/05 16:41 upstream c1c07416cdd4 6a0382b5 .config console log report ci-upstream-kasan-gce-386
2019/01/20 06:11 net-old 3e64cf7a435e 353f32ea .config console log report ci-upstream-net-this-kasan-gce
2018/09/12 17:35 net-old cc4dfb7f70a3 71907daf .config console log report ci-upstream-net-this-kasan-gce
2018/08/19 20:11 net-old bb107456ba5a 2dc4378f .config console log report ci-upstream-net-this-kasan-gce
2018/11/10 18:24 net-next-old 12ceaf8864c2 f9815aaf .config console log report ci-upstream-net-kasan-gce
2018/08/24 18:03 net-next-old 2ad0d5269970 95b5c82b .config console log report ci-upstream-net-kasan-gce
2018/06/25 02:30 net-next-old 0ef8b4567d08 2064fc5c .config console log report ci-upstream-net-kasan-gce
2018/06/23 21:47 net-next-old dd55c4ea9e6b 2064fc5c .config console log report ci-upstream-net-kasan-gce
2018/06/22 01:15 net-next-old f0dc7f9c6dd9 095ef806 .config console log report ci-upstream-net-kasan-gce
2018/06/19 21:18 net-next-old f0dc7f9c6dd9 732e4256 .config console log report ci-upstream-net-kasan-gce
2018/06/17 07:10 net-next-old f0dc7f9c6dd9 27c5f59f .config console log report ci-upstream-net-kasan-gce
2018/06/10 13:16 net-next-old 3a979e8c07e3 866118af .config console log report ci-upstream-net-kasan-gce
2018/06/06 23:16 net-next-old 7170e6045a6a e0e534c6 .config console log report ci-upstream-net-kasan-gce
2018/06/06 08:04 net-next-old 75d4e704fa8d 863a24bb .config console log report ci-upstream-net-kasan-gce
2018/06/04 11:04 net-next-old f624434a0ec9 6cbe7c26 .config console log report ci-upstream-net-kasan-gce
2018/06/03 20:38 net-next-old eaf47b17a77f 2f93b54f .config console log report ci-upstream-net-kasan-gce
2018/06/02 20:51 net-next-old 1ffdd8e1643f 2f93b54f .config console log report ci-upstream-net-kasan-gce
2018/06/02 07:38 net-next-old 21ad1173589e 2f93b54f .config console log report ci-upstream-net-kasan-gce
2018/06/02 05:55 net-next-old 21ad1173589e 2f93b54f .config console log report ci-upstream-net-kasan-gce
2018/05/30 04:13 net-next-old ae40832e53c3 2f93b54f .config console log report ci-upstream-net-kasan-gce
2018/05/27 13:20 net-next-old 5b79c2af667c f48c20b8 .config console log report ci-upstream-net-kasan-gce
2019/03/17 01:02 linux-next cf08baa29613 bab43553 .config console log report ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.