syzbot


possible deadlock in nci_start_poll

Status: upstream: reported C repro on 2022/11/14 22:27
Reported-by: syzbot+f1f36887d202cea1446d@syzkaller.appspotmail.com
First crash: 18d, last: 2h13m

Cause bisection: failed (bisect log)
Patch testing requests:
Created Duration User Patch Repo Result
2022/11/15 11:05 20m hdanton@sina.com patch https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 094226ad94f4 OK log

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.1.0-rc6-syzkaller-00251-g0b1dcc2cf55a #0 Not tainted
------------------------------------------------------
syz-executor211/3638 is trying to acquire lock:
ffff88801706f350 (&ndev->req_lock){+.+.}-{3:3}, at: nci_request net/nfc/nci/core.c:148 [inline]
ffff88801706f350 (&ndev->req_lock){+.+.}-{3:3}, at: nci_set_local_general_bytes net/nfc/nci/core.c:774 [inline]
ffff88801706f350 (&ndev->req_lock){+.+.}-{3:3}, at: nci_start_poll+0x688/0x900 net/nfc/nci/core.c:838

but task is already holding lock:
ffff88801706c508 (&genl_data->genl_data_mutex){+.+.}-{3:3}, at: nfc_genl_start_poll+0x19e/0x490 net/nfc/netlink.c:826

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (&genl_data->genl_data_mutex){+.+.}-{3:3}:
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x12f/0x1360 kernel/locking/mutex.c:747
       nfc_urelease_event_work+0x143/0x2d0 net/nfc/netlink.c:1811
       process_one_work+0x9bf/0x1710 kernel/workqueue.c:2289
       worker_thread+0x669/0x1090 kernel/workqueue.c:2436
       kthread+0x2e8/0x3a0 kernel/kthread.c:376
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306

-> #2 (nfc_devlist_mutex){+.+.}-{3:3}:
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x12f/0x1360 kernel/locking/mutex.c:747
       nfc_register_device+0x32/0x3b0 net/nfc/core.c:1116
       nci_register_device+0x7cb/0xb50 net/nfc/nci/core.c:1256
       virtual_ncidev_open+0x71/0x110 drivers/nfc/virtual_ncidev.c:146
       misc_open+0x37a/0x4a0 drivers/char/misc.c:143
       chrdev_open+0x26a/0x770 fs/char_dev.c:414
       do_dentry_open+0x6cc/0x13f0 fs/open.c:882
       do_open fs/namei.c:3557 [inline]
       path_openat+0x1bf6/0x2860 fs/namei.c:3714
       do_filp_open+0x1ba/0x410 fs/namei.c:3741
       do_sys_openat2+0x16d/0x4c0 fs/open.c:1310
       do_sys_open fs/open.c:1326 [inline]
       __do_sys_openat fs/open.c:1342 [inline]
       __se_sys_openat fs/open.c:1337 [inline]
       __x64_sys_openat+0x143/0x1f0 fs/open.c:1337
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

-> #1 (nci_mutex){+.+.}-{3:3}:
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x12f/0x1360 kernel/locking/mutex.c:747
       virtual_nci_close+0x17/0x50 drivers/nfc/virtual_ncidev.c:44
       nci_open_device net/nfc/nci/core.c:544 [inline]
       nci_dev_up+0x4cb/0x660 net/nfc/nci/core.c:631
       nfc_dev_up+0x1aa/0x3b0 net/nfc/core.c:118
       nfc_genl_dev_up+0xa6/0xf0 net/nfc/netlink.c:770
       genl_family_rcv_msg_doit+0x228/0x320 net/netlink/genetlink.c:756
       genl_family_rcv_msg net/netlink/genetlink.c:833 [inline]
       genl_rcv_msg+0x445/0x780 net/netlink/genetlink.c:850
       netlink_rcv_skb+0x157/0x430 net/netlink/af_netlink.c:2540
       genl_rcv+0x28/0x40 net/netlink/genetlink.c:861
       netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline]
       netlink_unicast+0x547/0x7f0 net/netlink/af_netlink.c:1345
       netlink_sendmsg+0x91b/0xe10 net/netlink/af_netlink.c:1921
       sock_sendmsg_nosec net/socket.c:714 [inline]
       sock_sendmsg+0xd3/0x120 net/socket.c:734
       ____sys_sendmsg+0x712/0x8c0 net/socket.c:2482
       ___sys_sendmsg+0x110/0x1b0 net/socket.c:2536
       __sys_sendmsg+0xf7/0x1c0 net/socket.c:2565
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

-> #0 (&ndev->req_lock){+.+.}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3097 [inline]
       check_prevs_add kernel/locking/lockdep.c:3216 [inline]
       validate_chain kernel/locking/lockdep.c:3831 [inline]
       __lock_acquire+0x2a43/0x56d0 kernel/locking/lockdep.c:5055
       lock_acquire kernel/locking/lockdep.c:5668 [inline]
       lock_acquire+0x1e3/0x630 kernel/locking/lockdep.c:5633
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x12f/0x1360 kernel/locking/mutex.c:747
       nci_request net/nfc/nci/core.c:148 [inline]
       nci_set_local_general_bytes net/nfc/nci/core.c:774 [inline]
       nci_start_poll+0x688/0x900 net/nfc/nci/core.c:838
       nfc_start_poll+0x192/0x320 net/nfc/core.c:225
       nfc_genl_start_poll+0x1ac/0x490 net/nfc/netlink.c:828
       genl_family_rcv_msg_doit+0x228/0x320 net/netlink/genetlink.c:756
       genl_family_rcv_msg net/netlink/genetlink.c:833 [inline]
       genl_rcv_msg+0x445/0x780 net/netlink/genetlink.c:850
       netlink_rcv_skb+0x157/0x430 net/netlink/af_netlink.c:2540
       genl_rcv+0x28/0x40 net/netlink/genetlink.c:861
       netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline]
       netlink_unicast+0x547/0x7f0 net/netlink/af_netlink.c:1345
       netlink_sendmsg+0x91b/0xe10 net/netlink/af_netlink.c:1921
       sock_sendmsg_nosec net/socket.c:714 [inline]
       sock_sendmsg+0xd3/0x120 net/socket.c:734
       ____sys_sendmsg+0x712/0x8c0 net/socket.c:2482
       ___sys_sendmsg+0x110/0x1b0 net/socket.c:2536
       __sys_sendmsg+0xf7/0x1c0 net/socket.c:2565
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

other info that might help us debug this:

Chain exists of:
  &ndev->req_lock --> nfc_devlist_mutex --> &genl_data->genl_data_mutex

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&genl_data->genl_data_mutex);
                               lock(nfc_devlist_mutex);
                               lock(&genl_data->genl_data_mutex);
  lock(&ndev->req_lock);

 *** DEADLOCK ***

4 locks held by syz-executor211/3638:
 #0: ffffffff8df50630 (cb_lock){++++}-{3:3}, at: genl_rcv+0x19/0x40 net/netlink/genetlink.c:860
 #1: ffffffff8df506e8 (genl_mutex){+.+.}-{3:3}, at: genl_lock net/netlink/genetlink.c:33 [inline]
 #1: ffffffff8df506e8 (genl_mutex){+.+.}-{3:3}, at: genl_rcv_msg+0x50d/0x780 net/netlink/genetlink.c:848
 #2: ffff88801706c508 (&genl_data->genl_data_mutex){+.+.}-{3:3}, at: nfc_genl_start_poll+0x19e/0x490 net/nfc/netlink.c:826
 #3: ffff88801706c100 (&dev->mutex){....}-{3:3}, at: device_lock include/linux/device.h:835 [inline]
 #3: ffff88801706c100 (&dev->mutex){....}-{3:3}, at: nfc_start_poll+0x58/0x320 net/nfc/core.c:208

stack backtrace:
CPU: 1 PID: 3638 Comm: syz-executor211 Not tainted 6.1.0-rc6-syzkaller-00251-g0b1dcc2cf55a #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106
 check_noncircular+0x25f/0x2e0 kernel/locking/lockdep.c:2177
 check_prev_add kernel/locking/lockdep.c:3097 [inline]
 check_prevs_add kernel/locking/lockdep.c:3216 [inline]
 validate_chain kernel/locking/lockdep.c:3831 [inline]
 __lock_acquire+0x2a43/0x56d0 kernel/locking/lockdep.c:5055
 lock_acquire kernel/locking/lockdep.c:5668 [inline]
 lock_acquire+0x1e3/0x630 kernel/locking/lockdep.c:5633
 __mutex_lock_common kernel/locking/mutex.c:603 [inline]
 __mutex_lock+0x12f/0x1360 kernel/locking/mutex.c:747
 nci_request net/nfc/nci/core.c:148 [inline]
 nci_set_local_general_bytes net/nfc/nci/core.c:774 [inline]
 nci_start_poll+0x688/0x900 net/nfc/nci/core.c:838
 nfc_start_poll+0x192/0x320 net/nfc/core.c:225
 nfc_genl_start_poll+0x1ac/0x490 net/nfc/netlink.c:828
 genl_family_rcv_msg_doit+0x228/0x320 net/netlink/genetlink.c:756
 genl_family_rcv_msg net/netlink/genetlink.c:833 [inline]
 genl_rcv_msg+0x445/0x780 net/netlink/genetlink.c:850
 netlink_rcv_skb+0x157/0x430 net/netlink/af_netlink.c:2540
 genl_rcv+0x28/0x40 net/netlink/genetlink.c:861
 netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline]
 netlink_unicast+0x547/0x7f0 net/netlink/af_netlink.c:1345
 netlink_sendmsg+0x91b/0xe10 net/netlink/af_netlink.c:1921
 sock_sendmsg_nosec net/socket.c:714 [inline]
 sock_sendmsg+0xd3/0x120 net/socket.c:734
 ____sys_sendmsg+0x712/0x8c0 net/socket.c:2482
 ___sys_sendmsg+0x110/0x1b0 net/socket.c:2536
 __sys_sendmsg+0xf7/0x1c0 net/socket.c:2565
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7ff82ce87639
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 41 15 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:00007ff82ce38318 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007ff82cf0f428 RCX: 00007ff82ce87639
RDX: 0000000000000000 RSI: 0000000020000440 RDI: 0000000000000004
RBP: 00007ff82cf0f420 R08: 0000000000000003 R09: 0000000000000000
R10: 0000000000000008 R11: 0000000000000246 R12: 00007ff82cedd064
R13: 00007ffe0dfc945f R14: 00007ff82ce38400 R15: 0000000000022000
 </TASK>
nci: __nci_request: wait_for_completion_interruptible_timeout failed -512
nci: nci_start_poll: failed to set local general bytes
nci: __nci_request: wait_for_completion_interruptible_timeout failed 0

Crashes (46):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce-root 2022/11/26 14:09 upstream 0b1dcc2cf55a 74a66371 .config log report syz C possible deadlock in nci_start_poll
ci-upstream-kasan-gce-root 2022/11/26 11:58 upstream 0b1dcc2cf55a 74a66371 .config log report syz C possible deadlock in nci_start_poll
ci-upstream-kasan-gce-root 2022/11/26 11:31 upstream 0b1dcc2cf55a 74a66371 .config log report syz C possible deadlock in nci_start_poll
ci-upstream-kasan-gce-root 2022/11/26 10:58 upstream 0b1dcc2cf55a 74a66371 .config log report syz C possible deadlock in nci_start_poll
ci-upstream-kasan-gce-root 2022/11/26 07:22 upstream 0b1dcc2cf55a 74a66371 .config log report syz C possible deadlock in nci_start_poll
ci-upstream-kasan-gce-smack-root 2022/11/14 18:41 upstream 094226ad94f4 943f4cb8 .config log report syz C possible deadlock in nci_start_poll
ci-upstream-kasan-gce-root 2022/11/30 19:33 upstream 04aa64375f48 4c2a66e8 .config log report info possible deadlock in nci_start_poll
ci-upstream-kasan-gce-root 2022/11/30 12:54 upstream 01f856ae6d0c 4c2a66e8 .config log report info possible deadlock in nci_start_poll
ci-upstream-kasan-gce-smack-root 2022/11/30 01:38 upstream 01f856ae6d0c 05dc7993 .config log report info possible deadlock in nci_start_poll
ci-upstream-kasan-gce-root 2022/11/29 06:21 upstream ca57f02295f1 ca9683b8 .config log report info possible deadlock in nci_start_poll
ci-upstream-kasan-gce-root 2022/11/27 12:53 upstream faf68e3523c2 74a66371 .config log report info possible deadlock in nci_start_poll
ci-upstream-kasan-gce-selinux-root 2022/11/26 20:53 upstream 644e9524388a 74a66371 .config log report info possible deadlock in nci_start_poll
ci-upstream-kasan-gce-smack-root 2022/11/25 20:41 upstream 0b1dcc2cf55a 74a66371 .config log report info possible deadlock in nci_start_poll
ci-upstream-kasan-gce-smack-root 2022/11/23 00:53 upstream eb7081409f94 9da37ae8 .config log report info possible deadlock in nci_start_poll
ci-upstream-kasan-gce-root 2022/11/21 02:42 upstream 77c51ba552a1 5bb70014 .config log report info possible deadlock in nci_start_poll
ci-qemu2-arm64 2022/12/03 13:57 upstream 97ee9d1c1696 e080de16 .config log report info possible deadlock in nci_start_poll
ci-qemu2-arm64 2022/12/03 06:15 upstream bdaa78c6aa86 e080de16 .config log report info possible deadlock in nci_start_poll
ci-qemu2-arm64 2022/12/01 23:03 upstream ef4d3ea40565 3b580c21 .config log report info possible deadlock in nci_start_poll
ci-qemu2-arm64 2022/12/01 20:40 upstream ef4d3ea40565 3b580c21 .config log report info possible deadlock in nci_start_poll
ci-qemu2-arm64 2022/11/30 07:26 upstream 01f856ae6d0c 579a3740 .config log report info possible deadlock in nci_start_poll
ci-qemu2-arm64 2022/11/28 22:57 upstream b7b275e60bcd ca9683b8 .config log report info possible deadlock in nci_start_poll
ci-qemu2-arm64 2022/11/28 20:57 upstream b7b275e60bcd b1062ff6 .config log report info possible deadlock in nci_start_poll
ci-qemu2-arm64 2022/11/28 12:12 upstream b7b275e60bcd b1062ff6 .config log report info possible deadlock in nci_start_poll
ci-qemu2-arm64 2022/11/28 04:00 upstream bf82d38c91f8 f4470a7b .config log report info possible deadlock in nci_start_poll
ci-qemu2-arm64 2022/11/28 02:59 upstream bf82d38c91f8 f4470a7b .config log report info possible deadlock in nci_start_poll
ci-qemu2-arm64 2022/11/27 21:10 upstream bf82d38c91f8 f4470a7b .config log report info possible deadlock in nci_start_poll
ci-qemu2-arm64 2022/11/26 23:32 upstream 644e9524388a f4470a7b .config log report info possible deadlock in nci_start_poll
ci-qemu2-arm64 2022/11/24 10:32 upstream 4312098baf37 ff68ff8f .config log report info possible deadlock in nci_start_poll
ci-qemu2-arm64 2022/11/24 08:13 upstream 4312098baf37 ff68ff8f .config log report info possible deadlock in nci_start_poll
ci-qemu2-arm64 2022/11/24 04:02 upstream 4312098baf37 ff68ff8f .config log report info possible deadlock in nci_start_poll
ci-qemu2-arm64 2022/11/23 20:32 upstream 4312098baf37 52fdf57a .config log report info possible deadlock in nci_start_poll
ci-qemu2-arm64 2022/11/23 09:32 upstream eb7081409f94 75740b3f .config log report info possible deadlock in nci_start_poll
ci-qemu2-arm64 2022/11/22 20:46 upstream eb7081409f94 1c8e10bc .config log report info possible deadlock in nci_start_poll
ci-qemu2-arm64 2022/11/22 13:38 upstream eb7081409f94 1c8e10bc .config log report info possible deadlock in nci_start_poll
ci-qemu2-arm64 2022/11/22 07:03 upstream eb7081409f94 1c576c23 .config log report info possible deadlock in nci_start_poll
ci-qemu2-arm64 2022/11/21 20:05 upstream eb7081409f94 f9a97739 .config log report info possible deadlock in nci_start_poll
ci-qemu2-arm64 2022/11/21 15:14 upstream eb7081409f94 f9a97739 .config log report info possible deadlock in nci_start_poll
ci-qemu2-arm64 2022/11/21 03:42 upstream eb7081409f94 5bb70014 .config log report info possible deadlock in nci_start_poll
ci-qemu2-arm64 2022/11/20 23:58 upstream 77c51ba552a1 5bb70014 .config log report info possible deadlock in nci_start_poll
ci-qemu2-arm64 2022/11/19 20:27 upstream fe24a97cf254 5bb70014 .config log report info possible deadlock in nci_start_poll
ci-qemu2-arm64 2022/11/19 08:16 upstream ab290eaddc4c 5bb70014 .config log report info possible deadlock in nci_start_poll
ci-qemu2-arm64 2022/11/19 02:40 upstream ab290eaddc4c 5bb70014 .config log report info possible deadlock in nci_start_poll
ci-qemu2-arm64 2022/11/18 13:55 upstream 84368d882b96 5bb70014 .config log report info possible deadlock in nci_start_poll
ci-qemu2-arm64 2022/11/17 08:42 upstream cc675d22e422 bfcab33d .config log report info possible deadlock in nci_start_poll
ci-upstream-linux-next-kasan-gce-root 2022/11/20 18:42 linux-next 15f3bff12cf6 5bb70014 .config log report info possible deadlock in nci_start_poll
ci-upstream-linux-next-kasan-gce-root 2022/11/17 21:54 linux-next 15f3bff12cf6 4ba8ab94 .config log report info possible deadlock in nci_start_poll
* Struck through repros no longer work on HEAD.