syzbot


possible deadlock in kcm_sendpage

Status: fixed on 2017/10/24 06:54
Fix commit: 351050ecd652 kcm: do not attach PF_KCM sockets to avoid deadlock
First crash: 2422d, last: 2419d

Sample crash report:
============================================
WARNING: possible recursive locking detected
4.13.0-rc6+ #29 Not tainted
--------------------------------------------
syz-executor2/5642 is trying to acquire lock:
 (sk_lock-AF_KCM){+.+.+.}, at: [<ffffffff8467d8be>] lock_sock include/net/sock.h:1459 [inline]
 (sk_lock-AF_KCM){+.+.+.}, at: [<ffffffff8467d8be>] kcm_sendpage+0x16e/0x1880 net/kcm/kcmsock.c:774

but task is already holding lock:
 (sk_lock-AF_KCM){+.+.+.}, at: [<ffffffff8467f1bc>] lock_sock include/net/sock.h:1459 [inline]
 (sk_lock-AF_KCM){+.+.+.}, at: [<ffffffff8467f1bc>] kcm_sendmsg+0x1ec/0x2200 net/kcm/kcmsock.c:910

other info that might help us debug this:
 Possible unsafe locking scenario:

       CPU0
       ----
  lock(sk_lock-AF_KCM);
  lock(sk_lock-AF_KCM);

 *** DEADLOCK ***

 May be due to missing lock nesting notation

1 lock held by syz-executor2/5642:
 #0:  (sk_lock-AF_KCM){+.+.+.}, at: [<ffffffff8467f1bc>] lock_sock include/net/sock.h:1459 [inline]
 #0:  (sk_lock-AF_KCM){+.+.+.}, at: [<ffffffff8467f1bc>] kcm_sendmsg+0x1ec/0x2200 net/kcm/kcmsock.c:910

stack backtrace:
CPU: 0 PID: 5642 Comm: syz-executor2 Not tainted 4.13.0-rc6+ #29
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:16 [inline]
 dump_stack+0x194/0x257 lib/dump_stack.c:52
 print_deadlock_bug kernel/locking/lockdep.c:1743 [inline]
 check_deadlock kernel/locking/lockdep.c:1787 [inline]
 validate_chain kernel/locking/lockdep.c:2265 [inline]
 __lock_acquire+0xfac/0x3dc0 kernel/locking/lockdep.c:3367
 lock_acquire+0x1d5/0x580 kernel/locking/lockdep.c:3855
 lock_sock_nested+0xc2/0x110 net/core/sock.c:2762
 lock_sock include/net/sock.h:1459 [inline]
 kcm_sendpage+0x16e/0x1880 net/kcm/kcmsock.c:774
 kernel_sendpage+0x8d/0xe0 net/socket.c:3387
 kcm_write_msgs+0x404/0x1b80 net/kcm/kcmsock.c:646
 kcm_sendmsg+0x1446/0x2200 net/kcm/kcmsock.c:1035
 sock_sendmsg_nosec net/socket.c:633 [inline]
 sock_sendmsg+0xca/0x110 net/socket.c:643
 sock_write_iter+0x31a/0x5d0 net/socket.c:912
 call_write_iter include/linux/fs.h:1743 [inline]
 new_sync_write fs/read_write.c:457 [inline]
 __vfs_write+0x684/0x970 fs/read_write.c:470
 vfs_write+0x189/0x510 fs/read_write.c:518
 SYSC_write fs/read_write.c:565 [inline]
 SyS_write+0xef/0x220 fs/read_write.c:557
 entry_SYSCALL_64_fastpath+0x1f/0xbe
RIP: 0033:0x4512e9
RSP: 002b:00007f14c9a83c08 EFLAGS: 00000216 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 0000000000718000 RCX: 00000000004512e9
RDX: 000000000000009a RSI: 0000000020ef4000 RDI: 0000000000000007
RBP: 0000000000000086 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000216 R12: 00000000004b70fc
R13: 00000000ffffffff R14: 0000000020000000 R15: 0000000000ef8000

Crashes (14):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2017/08/30 16:44 net-next-old d081a16db80e 1d000225 .config console log report syz ci-upstream-net-kasan-gce
2017/08/31 07:59 linux-next 9458bf6edfa8 ed7f9598 .config console log report syz ci-upstream-next-kasan-gce
2017/09/02 04:14 net-next-old 4cc5b44b29a9 aa51461a .config console log report ci-upstream-net-kasan-gce
2017/09/02 02:41 net-next-old 4cc5b44b29a9 aa51461a .config console log report ci-upstream-net-kasan-gce
2017/09/02 01:17 net-next-old 4cc5b44b29a9 aa51461a .config console log report ci-upstream-net-kasan-gce
2017/09/01 23:20 net-next-old 8fd682072335 70ab363e .config console log report ci-upstream-net-kasan-gce
2017/09/01 17:54 net-next-old 8fd682072335 70ab363e .config console log report ci-upstream-net-kasan-gce
2017/08/31 19:50 net-next-old acfb98b99647 5a093b74 .config console log report ci-upstream-net-kasan-gce
2017/08/31 18:59 net-next-old acfb98b99647 5a093b74 .config console log report ci-upstream-net-kasan-gce
2017/08/31 16:06 net-next-old acfb98b99647 5a093b74 .config console log report ci-upstream-net-kasan-gce
2017/08/30 19:50 net-next-old d081a16db80e 1d000225 .config console log report ci-upstream-net-kasan-gce
2017/08/30 16:23 net-next-old d081a16db80e 1d000225 .config console log report ci-upstream-net-kasan-gce
2017/08/29 23:56 net-next-old c8488a8ad7c2 be291771 .config console log report ci-upstream-net-kasan-gce
2017/08/29 20:22 net-next-old c8488a8ad7c2 be291771 .config console log report ci-upstream-net-kasan-gce
* Struck through repros no longer work on HEAD.