syzbot


possible deadlock in kcm_ioctl

Status: upstream: reported C repro on 2020/02/04 19:56
Reported-by: syzbot+fc32a77073ca93da3c99@syzkaller.appspotmail.com
First crash: 1596d, last: 477d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in kcm_ioctl net C error 20 666d 668d 22/27 fixed on 2023/02/24 13:50
Fix bisection attempts (7)
Created Duration User Patch Repo Result
2023/02/28 02:05 1h41m bisect fix linux-4.14.y job log (0) log
2023/01/26 07:03 31m bisect fix linux-4.14.y job log (0) log
2022/11/17 12:59 25m bisect fix linux-4.14.y job log (0) log
2022/10/18 12:22 30m bisect fix linux-4.14.y job log (0) log
2021/12/02 02:32 30m bisect fix linux-4.14.y job log (0) log
2021/10/31 18:48 26m bisect fix linux-4.14.y job log (0) log
2021/06/18 23:02 22m bisect fix linux-4.14.y job log (0) log

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
4.14.290-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor282/7976 is trying to acquire lock:
 ((&strp->work)){+.+.}, at: [<ffffffff81367998>] flush_work+0x88/0x770 kernel/workqueue.c:2887

but task is already holding lock:
 (sk_lock-AF_INET6){+.+.}, at: [<ffffffff86815ca8>] lock_sock include/net/sock.h:1473 [inline]
 (sk_lock-AF_INET6){+.+.}, at: [<ffffffff86815ca8>] kcm_attach net/kcm/kcmsock.c:1390 [inline]
 (sk_lock-AF_INET6){+.+.}, at: [<ffffffff86815ca8>] kcm_attach_ioctl net/kcm/kcmsock.c:1490 [inline]
 (sk_lock-AF_INET6){+.+.}, at: [<ffffffff86815ca8>] kcm_ioctl+0x328/0xfb0 net/kcm/kcmsock.c:1701

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (sk_lock-AF_INET6){+.+.}:
       lock_sock_nested+0xb7/0x100 net/core/sock.c:2813
       do_strp_work net/strparser/strparser.c:415 [inline]
       strp_work+0x3e/0x100 net/strparser/strparser.c:434
       process_one_work+0x793/0x14a0 kernel/workqueue.c:2117
       worker_thread+0x5cc/0xff0 kernel/workqueue.c:2251
       kthread+0x30d/0x420 kernel/kthread.c:232
       ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

-> #0 ((&strp->work)){+.+.}:
       lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998
       flush_work+0xad/0x770 kernel/workqueue.c:2890
       __cancel_work_timer+0x321/0x460 kernel/workqueue.c:2965
       strp_done+0x53/0xd0 net/strparser/strparser.c:519
       kcm_attach net/kcm/kcmsock.c:1429 [inline]
       kcm_attach_ioctl net/kcm/kcmsock.c:1490 [inline]
       kcm_ioctl+0x828/0xfb0 net/kcm/kcmsock.c:1701
       sock_do_ioctl net/socket.c:974 [inline]
       sock_ioctl+0x2cc/0x4c0 net/socket.c:1071
       vfs_ioctl fs/ioctl.c:46 [inline]
       file_ioctl fs/ioctl.c:500 [inline]
       do_vfs_ioctl+0x75a/0xff0 fs/ioctl.c:684
       SYSC_ioctl fs/ioctl.c:701 [inline]
       SyS_ioctl+0x7f/0xb0 fs/ioctl.c:692
       do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
       entry_SYSCALL_64_after_hwframe+0x46/0xbb

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(sk_lock-AF_INET6);
                               lock((&strp->work));
                               lock(sk_lock-AF_INET6);
  lock((&strp->work));

 *** DEADLOCK ***

1 lock held by syz-executor282/7976:
 #0:  (sk_lock-AF_INET6){+.+.}, at: [<ffffffff86815ca8>] lock_sock include/net/sock.h:1473 [inline]
 #0:  (sk_lock-AF_INET6){+.+.}, at: [<ffffffff86815ca8>] kcm_attach net/kcm/kcmsock.c:1390 [inline]
 #0:  (sk_lock-AF_INET6){+.+.}, at: [<ffffffff86815ca8>] kcm_attach_ioctl net/kcm/kcmsock.c:1490 [inline]
 #0:  (sk_lock-AF_INET6){+.+.}, at: [<ffffffff86815ca8>] kcm_ioctl+0x328/0xfb0 net/kcm/kcmsock.c:1701

stack backtrace:
CPU: 0 PID: 7976 Comm: syz-executor282 Not tainted 4.14.290-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/22/2022
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x1b2/0x281 lib/dump_stack.c:58
 print_circular_bug.constprop.0.cold+0x2d7/0x41e kernel/locking/lockdep.c:1258
 check_prev_add kernel/locking/lockdep.c:1905 [inline]
 check_prevs_add kernel/locking/lockdep.c:2022 [inline]
 validate_chain kernel/locking/lockdep.c:2464 [inline]
 __lock_acquire+0x2e0e/0x3f20 kernel/locking/lockdep.c:3491
 lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998
 flush_work+0xad/0x770 kernel/workqueue.c:2890
 __cancel_work_timer+0x321/0x460 kernel/workqueue.c:2965
 strp_done+0x53/0xd0 net/strparser/strparser.c:519
 kcm_attach net/kcm/kcmsock.c:1429 [inline]
 kcm_attach_ioctl net/kcm/kcmsock.c:1490 [inline]
 kcm_ioctl+0x828/0xfb0 net/kcm/kcmsock.c:1701
 sock_do_ioctl net/socket.c:974 [inline]
 sock_ioctl+0x2cc/0x4c0 net/socket.c:1071
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:500 [inline]
 do_vfs_ioctl+0x75a/0xff0 fs/ioctl.c:684
 SYSC_ioctl fs/ioctl.c:701 [inline]
 SyS_ioctl+0x7f/0xb0 fs/ioctl.c:692
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x7f06f60d93e9
RSP: 002b:00007ffdc3489528 EFLAGS: 00000246 ORIG_RAX: 0000000000000010

Crashes (1178):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/08/18 04:38 linux-4.14.y b641242202ed a9409d47 .config console log report syz C ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/07/26 20:44 linux-4.14.y 9c3bf9cf362f 279b89c2 .config console log report syz C ci2-linux-4-14 possible deadlock in kcm_ioctl
2020/03/23 05:11 linux-4.14.y 01364dad1d45 78267cec .config console log report syz ci2-linux-4-14
2020/03/22 03:41 linux-4.14.y 01364dad1d45 78267cec .config console log report syz ci2-linux-4-14
2020/03/11 09:53 linux-4.14.y 78d697fc93f9 35f53e45 .config console log report syz ci2-linux-4-14
2020/03/10 08:47 linux-4.14.y 78d697fc93f9 35f53e45 .config console log report syz ci2-linux-4-14
2020/03/01 01:25 linux-4.14.y 78d697fc93f9 c88c7b75 .config console log report syz ci2-linux-4-14
2020/02/19 09:46 linux-4.14.y 98db2bf27b9e 135c18aa .config console log report syz ci2-linux-4-14
2022/09/15 01:59 linux-4.14.y 65640c873dcf b884348d .config console log report info [disk image] [vmlinux] ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/09/14 20:19 linux-4.14.y 65640c873dcf b884348d .config console log report info [disk image] [vmlinux] ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/09/12 20:34 linux-4.14.y 65640c873dcf f371ed7e .config console log report info [disk image] [vmlinux] ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/09/12 16:47 linux-4.14.y 65640c873dcf f371ed7e .config console log report info [disk image] [vmlinux] ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/09/12 07:20 linux-4.14.y 65640c873dcf 356d8217 .config console log report info ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/09/12 01:12 linux-4.14.y 65640c873dcf 356d8217 .config console log report info ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/09/11 22:57 linux-4.14.y 65640c873dcf 356d8217 .config console log report info ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/09/10 21:15 linux-4.14.y 65640c873dcf 356d8217 .config console log report info ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/09/10 01:59 linux-4.14.y 65640c873dcf 356d8217 .config console log report info ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/09/10 00:34 linux-4.14.y 65640c873dcf 356d8217 .config console log report info ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/09/09 12:36 linux-4.14.y 65640c873dcf 90058bdc .config console log report info ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/09/09 09:47 linux-4.14.y 65640c873dcf f3027468 .config console log report info ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/09/08 18:43 linux-4.14.y 65640c873dcf f3027468 .config console log report info ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/09/08 08:21 linux-4.14.y 65640c873dcf 435aeef7 .config console log report info [disk image] [vmlinux] ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/09/06 00:56 linux-4.14.y 65640c873dcf 9dcd38fc .config console log report info [disk image] [vmlinux] ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/09/05 22:38 linux-4.14.y 65640c873dcf 9dcd38fc .config console log report info [disk image] [vmlinux] ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/09/05 16:31 linux-4.14.y 65640c873dcf 922294ab .config console log report info [disk image] [vmlinux] ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/09/04 19:41 linux-4.14.y e548869f356f 28811d0a .config console log report info [disk image] [vmlinux] ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/09/01 01:14 linux-4.14.y e548869f356f 51e54e30 .config console log report info [disk image] [vmlinux] ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/08/30 12:19 linux-4.14.y e548869f356f 4a380809 .config console log report info ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/08/30 08:48 linux-4.14.y e548869f356f 4a380809 .config console log report info ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/08/30 03:44 linux-4.14.y e548869f356f 4a380809 .config console log report info ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/08/29 21:07 linux-4.14.y e548869f356f d7593c58 .config console log report info [disk image] [vmlinux] ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/08/28 17:27 linux-4.14.y e548869f356f 07177916 .config console log report info ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/08/28 16:26 linux-4.14.y e548869f356f 07177916 .config console log report info ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/08/27 04:45 linux-4.14.y e548869f356f 07177916 .config console log report info ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/08/26 18:56 linux-4.14.y e548869f356f e5a303f1 .config console log report info ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/08/25 02:40 linux-4.14.y b641242202ed 514514f6 .config console log report info ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/08/22 16:23 linux-4.14.y b641242202ed 26a13b38 .config console log report info ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/08/22 14:03 linux-4.14.y b641242202ed 26a13b38 .config console log report info ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/08/22 02:55 linux-4.14.y b641242202ed 26a13b38 .config console log report info ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/08/21 23:50 linux-4.14.y b641242202ed 26a13b38 .config console log report info ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/08/21 08:04 linux-4.14.y b641242202ed 26a13b38 .config console log report info ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/08/20 01:04 linux-4.14.y b641242202ed 26a13b38 .config console log report info ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/08/19 23:42 linux-4.14.y b641242202ed 26a13b38 .config console log report info ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/08/19 16:58 linux-4.14.y b641242202ed 26a13b38 .config console log report info ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/08/19 11:09 linux-4.14.y b641242202ed 26a13b38 .config console log report info ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/08/19 05:51 linux-4.14.y b641242202ed 26a13b38 .config console log report info ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/08/18 19:23 linux-4.14.y b641242202ed d58e263f .config console log report info ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/08/18 07:50 linux-4.14.y b641242202ed a9409d47 .config console log report info ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/08/17 03:26 linux-4.14.y b641242202ed 9e4b39c2 .config console log report info ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/08/13 05:47 linux-4.14.y b641242202ed 8dfcaa3d .config console log report info ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/08/13 03:44 linux-4.14.y b641242202ed 8dfcaa3d .config console log report info ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/08/12 16:30 linux-4.14.y b641242202ed 402cd70d .config console log report info ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/08/11 23:33 linux-4.14.y b641242202ed 21724cb2 .config console log report info ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/08/11 22:23 linux-4.14.y b641242202ed 21724cb2 .config console log report info ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/08/11 11:27 linux-4.14.y b641242202ed 787ed7e0 .config console log report info ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/08/10 21:26 linux-4.14.y b641242202ed a6201f11 .config console log report info ci2-linux-4-14 possible deadlock in kcm_ioctl
2022/08/10 16:05 linux-4.14.y b641242202ed aaa9eaa0 .config console log report info ci2-linux-4-14 possible deadlock in kcm_ioctl
2021/01/17 13:59 linux-4.14.y 2762b48e9611 813be542 .config console log report info ci2-linux-4-14
2020/02/04 19:55 linux-4.14.y 9fa690a2a016 93e5e335 .config console log report ci2-linux-4-14
* Struck through repros no longer work on HEAD.