syzbot


possible deadlock in mptcp_close
Status: fixed on 2022/03/08 16:11
Reported-by: syzbot+1dd53f7a89b299d59eaf@syzkaller.appspotmail.com
Fix commit: 49054556289e net: introduce and use lock_sock_fast_nested()
First crash: 249d, last: 238d

Cause bisection: introduced by (bisect log) :
commit 2dcb96bacce36021c2f3eaae0cef607b5bb71ede
Author: Thomas Gleixner <tglx@linutronix.de>
Date: Sat Sep 18 12:42:35 2021 +0000

  net: core: Correct the sock::sk_lock.owned lockdep annotations

Crash: possible deadlock in mptcp_close (log)
Repro: C syz .config
Patch testing requests:
Created Duration User Patch Repo Result
2021/09/22 19:58 13m pabeni@redhat.com patch net OK
2021/09/22 17:56 5m pabeni@redhat.com patch net error

Sample crash report:
MPTCP: kernel_bind error, err=-98
============================================
WARNING: possible recursive locking detected
5.15.0-rc2-syzkaller #0 Not tainted
--------------------------------------------
syz-executor599/6541 is trying to acquire lock:
ffff88807c6c18a0 (k-sk_lock-AF_INET){+.+.}-{0:0}, at: mptcp_close+0x267/0x7b0 net/mptcp/protocol.c:2738

but task is already holding lock:
ffff88807cab8c60 (k-sk_lock-AF_INET){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1612 [inline]
ffff88807cab8c60 (k-sk_lock-AF_INET){+.+.}-{0:0}, at: mptcp_close+0x23/0x7b0 net/mptcp/protocol.c:2720

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

       CPU0
       ----
  lock(k-sk_lock-AF_INET);
  lock(k-sk_lock-AF_INET);

 *** DEADLOCK ***

 May be due to missing lock nesting notation

3 locks held by syz-executor599/6541:
 #0: ffffffff8d176e50 (cb_lock){++++}-{3:3}, at: genl_rcv+0x15/0x40 net/netlink/genetlink.c:802
 #1: ffffffff8d176f08 (genl_mutex){+.+.}-{3:3}, at: genl_lock net/netlink/genetlink.c:33 [inline]
 #1: ffffffff8d176f08 (genl_mutex){+.+.}-{3:3}, at: genl_rcv_msg+0x3e0/0x580 net/netlink/genetlink.c:790
 #2: ffff88807cab8c60 (k-sk_lock-AF_INET){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1612 [inline]
 #2: ffff88807cab8c60 (k-sk_lock-AF_INET){+.+.}-{0:0}, at: mptcp_close+0x23/0x7b0 net/mptcp/protocol.c:2720

stack backtrace:
CPU: 1 PID: 6541 Comm: syz-executor599 Not tainted 5.15.0-rc2-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
 print_deadlock_bug kernel/locking/lockdep.c:2944 [inline]
 check_deadlock kernel/locking/lockdep.c:2987 [inline]
 validate_chain kernel/locking/lockdep.c:3776 [inline]
 __lock_acquire.cold+0x149/0x3ab kernel/locking/lockdep.c:5015
 lock_acquire kernel/locking/lockdep.c:5625 [inline]
 lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5590
 lock_sock_fast+0x36/0x100 net/core/sock.c:3229
 mptcp_close+0x267/0x7b0 net/mptcp/protocol.c:2738
 inet_release+0x12e/0x280 net/ipv4/af_inet.c:431
 __sock_release net/socket.c:649 [inline]
 sock_release+0x87/0x1b0 net/socket.c:677
 mptcp_pm_nl_create_listen_socket+0x238/0x2c0 net/mptcp/pm_netlink.c:900
 mptcp_nl_cmd_add_addr+0x359/0x930 net/mptcp/pm_netlink.c:1170
 genl_family_rcv_msg_doit+0x228/0x320 net/netlink/genetlink.c:731
 genl_family_rcv_msg net/netlink/genetlink.c:775 [inline]
 genl_rcv_msg+0x328/0x580 net/netlink/genetlink.c:792
 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2504
 genl_rcv+0x24/0x40 net/netlink/genetlink.c:803
 netlink_unicast_kernel net/netlink/af_netlink.c:1314 [inline]
 netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1340
 netlink_sendmsg+0x86d/0xdb0 net/netlink/af_netlink.c:1929
 sock_sendmsg_nosec net/socket.c:704 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:724
 sock_no_sendpage+0xf3/0x130 net/core/sock.c:2980
 kernel_sendpage.part.0+0x1a0/0x340 net/socket.c:3504
 kernel_sendpage net/socket.c:3501 [inline]
 sock_sendpage+0xe5/0x140 net/socket.c:1003
 pipe_to_sendpage+0x2ad/0x380 fs/splice.c:364
 splice_from_pipe_feed fs/splice.c:418 [inline]
 __splice_from_pipe+0x43e/0x8a0 fs/splice.c:562
 splice_from_pipe fs/splice.c:597 [inline]
 generic_splice_sendpage+0xd4/0x140 fs/splice.c:746
 do_splice_from fs/splice.c:767 [inline]
 direct_splice_actor+0x110/0x180 fs/splice.c:936
 splice_direct_to_actor+0x34b/0x8c0 fs/splice.c:891
 do_splice_direct+0x1b3/0x280 fs/splice.c:979
 do_sendfile+0xae9/0x1240 fs/read_write.c:1249
 __do_sys_sendfile64 fs/read_write.c:1314 [inline]
 __se_sys_sendfile64 fs/read_write.c:1300 [inline]
 __x64_sys_sendfile64+0x1cc/0x210 fs/read_write.c:1300
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7fb4b3e5f969
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 14 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 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffff1f0b358 EFLAGS: 00000246 ORIG_RAX: 0000000000000028
RAX: ffffffffffffffda RBX: 00007fb4b3ea3072 RCX: 00007fb4b3e5f969
RDX: 0000000000000000 RSI: 0000000000000004 RDI: 0000000000000005
RBP: 0000000000000000 R08: 00007ffff1f0b4f8 R09: 00007ffff1f0b4f8
R10: 0000000100000002 R11: 0000000000000246 R12: 00007ffff1f0b36c
R13: 431bde82d7b634db R14: 0000000000000000 R15: 0000000000000000

Crashes (931):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-net-this-kasan-gce 2021/09/29 21:58 net d88fd1b546ff be530f6c .config log report syz C possible deadlock in mptcp_close
ci-upstream-net-this-kasan-gce 2021/09/20 05:45 net e30cd812dffa 70b76c1d .config log report syz C possible deadlock in mptcp_close
ci-upstream-net-kasan-gce 2021/09/29 23:35 net-next ef91abfb20c7 be530f6c .config log report syz C possible deadlock in mptcp_close
ci-upstream-kasan-gce-root 2021/10/01 12:04 upstream 02d5e016800d 1d849ab4 .config log report info possible deadlock in mptcp_close
ci-upstream-kasan-gce-selinux-root 2021/09/30 23:32 upstream 02d5e016800d 1d849ab4 .config log report info possible deadlock in mptcp_close
ci-upstream-kasan-gce-root 2021/09/30 22:19 upstream 02d5e016800d 1d849ab4 .config log report info possible deadlock in mptcp_close
ci-upstream-kasan-gce-smack-root 2021/09/30 21:23 upstream 02d5e016800d 1d849ab4 .config log report info possible deadlock in mptcp_close
ci-upstream-kasan-gce-smack-root 2021/09/30 20:22 upstream 02d5e016800d 1d849ab4 .config log report info possible deadlock in mptcp_close
ci-upstream-kasan-gce-selinux-root 2021/09/30 16:08 upstream 02d5e016800d be530f6c .config log report info possible deadlock in mptcp_close
ci-upstream-kasan-gce-smack-root 2021/09/29 19:40 upstream 02d5e016800d be530f6c .config log report info possible deadlock in mptcp_close
ci-upstream-kasan-gce-smack-root 2021/09/29 18:35 upstream 02d5e016800d be530f6c .config log report info possible deadlock in mptcp_close
ci-upstream-kasan-gce-root 2021/09/29 17:34 upstream 02d5e016800d be530f6c .config log report info possible deadlock in mptcp_close
ci-upstream-kasan-gce-selinux-root 2021/09/29 16:52 upstream 02d5e016800d be530f6c .config log report info possible deadlock in mptcp_close
ci-upstream-kasan-gce-smack-root 2021/09/29 14:50 upstream a4e6f95a891a be530f6c .config log report info possible deadlock in mptcp_close
ci-upstream-kasan-gce-smack-root 2021/09/29 07:35 upstream a4e6f95a891a d82cb927 .config log report info possible deadlock in mptcp_close
ci-upstream-kasan-gce-selinux-root 2021/09/29 07:23 upstream a4e6f95a891a d82cb927 .config log report info possible deadlock in mptcp_close
ci-upstream-kasan-gce-root 2021/09/29 06:11 upstream a4e6f95a891a d82cb927 .config log report info possible deadlock in mptcp_close
ci-upstream-kasan-gce-smack-root 2021/09/29 04:59 upstream a4e6f95a891a d82cb927 .config log report info possible deadlock in mptcp_close
ci-upstream-kasan-gce-root 2021/09/29 03:45 upstream d33bec7b3dfa d82cb927 .config log report info possible deadlock in mptcp_close
ci-upstream-kasan-gce-selinux-root 2021/09/29 02:50 upstream d33bec7b3dfa d82cb927 .config log report info possible deadlock in mptcp_close
ci-upstream-kasan-gce-root 2021/09/28 22:01 upstream d33bec7b3dfa d82cb927 .config log report info possible deadlock in mptcp_close
ci-upstream-kasan-gce-selinux-root 2021/09/28 19:11 upstream d33bec7b3dfa d82cb927 .config log report info possible deadlock in mptcp_close
ci-upstream-kasan-gce-root 2021/09/28 17:56 upstream d33bec7b3dfa d82cb927 .config log report info possible deadlock in mptcp_close
ci-upstream-kasan-gce-smack-root 2021/09/28 16:52 upstream d33bec7b3dfa d82cb927 .config log report info possible deadlock in mptcp_close
ci-upstream-kasan-gce-selinux-root 2021/09/28 15:20 upstream 0513e464f900 d82cb927 .config log report info possible deadlock in mptcp_close
ci-upstream-kasan-gce-root 2021/09/28 14:12 upstream 0513e464f900 d82cb927 .config log report info possible deadlock in mptcp_close
ci-upstream-kasan-gce-selinux-root 2021/09/28 10:36 upstream 0513e464f900 78494d16 .config log report info possible deadlock in mptcp_close
ci-upstream-net-this-kasan-gce 2021/09/30 17:24 net d88fd1b546ff be530f6c .config log report info possible deadlock in mptcp_close
ci-upstream-net-this-kasan-gce 2021/09/30 13:07 net d88fd1b546ff be530f6c .config log report info possible deadlock in mptcp_close
ci-upstream-net-this-kasan-gce 2021/09/30 11:56 net d88fd1b546ff be530f6c .config log report info possible deadlock in mptcp_close
ci-upstream-net-this-kasan-gce 2021/09/30 06:53 net d88fd1b546ff be530f6c .config log report info possible deadlock in mptcp_close
ci-upstream-net-this-kasan-gce 2021/09/30 03:34 net d88fd1b546ff be530f6c .config log report info possible deadlock in mptcp_close
ci-upstream-net-this-kasan-gce 2021/09/30 00:50 net d88fd1b546ff be530f6c .config log report info possible deadlock in mptcp_close
ci-upstream-net-this-kasan-gce 2021/09/29 15:50 net d88fd1b546ff be530f6c .config log report info possible deadlock in mptcp_close
ci-upstream-net-this-kasan-gce 2021/09/29 12:08 net 4ccb9f03fee7 d82cb927 .config log report info possible deadlock in mptcp_close
ci-upstream-net-this-kasan-gce 2021/09/29 10:07 net 4ccb9f03fee7 d82cb927 .config log report info possible deadlock in mptcp_close
ci-upstream-net-this-kasan-gce 2021/09/29 01:33 net c894b51e2a23 d82cb927 .config log report info possible deadlock in mptcp_close
ci-upstream-net-this-kasan-gce 2021/09/28 21:57 net c894b51e2a23 d82cb927 .config log report info possible deadlock in mptcp_close
ci-upstream-net-this-kasan-gce 2021/09/28 16:29 net c894b51e2a23 d82cb927 .config log report info possible deadlock in mptcp_close
ci-upstream-net-this-kasan-gce 2021/09/28 13:37 net c894b51e2a23 d82cb927 .config log report info possible deadlock in mptcp_close
ci-upstream-net-this-kasan-gce 2021/09/20 03:47 net e30cd812dffa 70b76c1d .config log report info possible deadlock in mptcp_close
ci-upstream-net-kasan-gce 2021/10/01 06:53 net-next 69508d43334e 1d849ab4 .config log report info possible deadlock in mptcp_close
ci-upstream-net-kasan-gce 2021/10/01 01:55 net-next 69508d43334e 1d849ab4 .config log report info possible deadlock in mptcp_close
ci-upstream-net-kasan-gce 2021/09/30 19:12 net-next 69508d43334e be530f6c .config log report info possible deadlock in mptcp_close
ci-upstream-net-kasan-gce 2021/09/30 15:07 net-next ef91abfb20c7 be530f6c .config log report info possible deadlock in mptcp_close
ci-upstream-net-kasan-gce 2021/09/30 10:37 net-next ef91abfb20c7 be530f6c .config log report info possible deadlock in mptcp_close
ci-upstream-net-kasan-gce 2021/09/30 05:45 net-next ef91abfb20c7 be530f6c .config log report info possible deadlock in mptcp_close
ci-upstream-net-kasan-gce 2021/09/30 01:53 net-next ef91abfb20c7 be530f6c .config log report info possible deadlock in mptcp_close
ci-upstream-net-kasan-gce 2021/09/29 23:01 net-next ef91abfb20c7 be530f6c .config log report info possible deadlock in mptcp_close
ci-upstream-net-kasan-gce 2021/09/29 21:39 net-next b69c99463d41 be530f6c .config log report info possible deadlock in mptcp_close
ci-upstream-net-kasan-gce 2021/09/29 14:23 net-next b69c99463d41 be530f6c .config log report info possible deadlock in mptcp_close
ci-upstream-net-kasan-gce 2021/09/29 13:18 net-next b69c99463d41 d82cb927 .config log report info possible deadlock in mptcp_close
ci-upstream-net-kasan-gce 2021/09/29 08:57 net-next b69c99463d41 d82cb927 .config log report info possible deadlock in mptcp_close
ci-upstream-net-kasan-gce 2021/09/29 00:22 net-next b69c99463d41 d82cb927 .config log report info possible deadlock in mptcp_close
ci-upstream-linux-next-kasan-gce-root 2021/09/30 08:07 linux-next c7b4d0e56a1d be530f6c .config log report info possible deadlock in mptcp_close