syzbot


possible deadlock in sk_clone_lock

Status: upstream: reported on 2024/09/17 04:59
Reported-by: syzbot+55b106420a82421a207b@syzkaller.appspotmail.com
First crash: 53d, last: 53d
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 possible deadlock in sk_clone_lock C error 4 1140d 1390d 0/1 upstream: reported C repro on 2021/01/19 15:48
upstream possible deadlock in sk_clone_lock mm 1 1354d 1352d 0/28 auto-closed as invalid on 2021/04/25 05:11
linux-4.14 possible deadlock in sk_clone_lock C error 3 803d 1329d 0/1 upstream: reported C repro on 2021/03/22 00:35
upstream possible deadlock in sk_clone_lock (3) mptcp C 21 16d 65d 27/28 upstream: reported C repro on 2024/09/05 17:03

Sample crash report:
============================================
WARNING: possible recursive locking detected
6.1.110-syzkaller #0 Not tainted
--------------------------------------------
syz.4.652/6183 is trying to acquire lock:
ffff8880278817b0 (k-slock-AF_INET){+.-.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline]
ffff8880278817b0 (k-slock-AF_INET){+.-.}-{2:2}, at: sk_clone_lock+0x2c9/0xf20 net/core/sock.c:2260

but task is already holding lock:
ffff88807a3f5670 (k-slock-AF_INET){+.-.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline]
ffff88807a3f5670 (k-slock-AF_INET){+.-.}-{2:2}, at: sk_clone_lock+0x2c9/0xf20 net/core/sock.c:2260

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

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

 *** DEADLOCK ***

 May be due to missing lock nesting notation

7 locks held by syz.4.652/6183:
 #0: ffff888027880cb0 (sk_lock-AF_INET){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1748 [inline]
 #0: ffff888027880cb0 (sk_lock-AF_INET){+.+.}-{0:0}, at: inet_stream_connect+0x4c/0xa0 net/ipv4/af_inet.c:740
 #1: ffff88807a3f6f70 (k-sk_lock-AF_INET){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1748 [inline]
 #1: ffff88807a3f6f70 (k-sk_lock-AF_INET){+.+.}-{0:0}, at: inet_stream_connect+0x4c/0xa0 net/ipv4/af_inet.c:740
 #2: ffffffff8d32b000 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:350 [inline]
 #2: ffffffff8d32b000 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:791 [inline]
 #2: ffffffff8d32b000 (rcu_read_lock){....}-{1:2}, at: __ip_queue_xmit+0x54/0x1b60 net/ipv4/ip_output.c:467
 #3: ffffffff8d32b000 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:350 [inline]
 #3: ffffffff8d32b000 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:791 [inline]
 #3: ffffffff8d32b000 (rcu_read_lock){....}-{1:2}, at: ip_finish_output2+0x402/0x1330 net/ipv4/ip_output.c:221
 #4: ffffffff8d32b000 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:350 [inline]
 #4: ffffffff8d32b000 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:791 [inline]
 #4: ffffffff8d32b000 (rcu_read_lock){....}-{1:2}, at: process_backlog+0x2c9/0x760 net/core/dev.c:5969
 #5: ffffffff8d32b000 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:350 [inline]
 #5: ffffffff8d32b000 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:791 [inline]
 #5: ffffffff8d32b000 (rcu_read_lock){....}-{1:2}, at: ip_local_deliver_finish+0x1f3/0x580 net/ipv4/ip_input.c:232
 #6: ffff88807a3f5670 (k-slock-AF_INET){+.-.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline]
 #6: ffff88807a3f5670 (k-slock-AF_INET){+.-.}-{2:2}, at: sk_clone_lock+0x2c9/0xf20 net/core/sock.c:2260

stack backtrace:
CPU: 1 PID: 6183 Comm: syz.4.652 Not tainted 6.1.110-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 print_deadlock_bug kernel/locking/lockdep.c:2983 [inline]
 check_deadlock kernel/locking/lockdep.c:3026 [inline]
 validate_chain+0x4711/0x5950 kernel/locking/lockdep.c:3812
 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049
 lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
 __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
 _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:154
 spin_lock include/linux/spinlock.h:351 [inline]
 sk_clone_lock+0x2c9/0xf20 net/core/sock.c:2260
 mptcp_sk_clone_init+0xa0/0x1330 net/mptcp/protocol.c:3233
 subflow_syn_recv_sock+0x950/0x1570 net/mptcp/subflow.c:764
 tcp_check_req+0xf96/0x19c0 net/ipv4/tcp_minisocks.c:787
 tcp_v4_rcv+0x1fd8/0x3250 net/ipv4/tcp_ipv4.c:2039
 ip_protocol_deliver_rcu+0x381/0x740 net/ipv4/ip_input.c:205
 ip_local_deliver_finish+0x304/0x580 net/ipv4/ip_input.c:233
 NF_HOOK+0x39d/0x450 include/linux/netfilter.h:302
 NF_HOOK+0x39d/0x450 include/linux/netfilter.h:302
 __netif_receive_skb_one_core net/core/dev.c:5528 [inline]
 __netif_receive_skb+0x1c6/0x530 net/core/dev.c:5642
 process_backlog+0x381/0x760 net/core/dev.c:5970
 __napi_poll+0xc7/0x470 net/core/dev.c:6537
 napi_poll net/core/dev.c:6604 [inline]
 net_rx_action+0x70f/0xeb0 net/core/dev.c:6718
 handle_softirqs+0x2ee/0xa40 kernel/softirq.c:571
 do_softirq+0x162/0x240 kernel/softirq.c:472
 </IRQ>
 <TASK>
 __local_bh_enable_ip+0x1b1/0x1f0 kernel/softirq.c:396
 local_bh_enable include/linux/bottom_half.h:33 [inline]
 rcu_read_unlock_bh include/linux/rcupdate.h:861 [inline]
 __dev_queue_xmit+0x1790/0x3cf0 net/core/dev.c:4320
 dev_queue_xmit include/linux/netdevice.h:3021 [inline]
 neigh_hh_output include/net/neighbour.h:528 [inline]
 neigh_output include/net/neighbour.h:542 [inline]
 ip_finish_output2+0xcfc/0x1330 net/ipv4/ip_output.c:228
 dst_output include/net/dst.h:444 [inline]
 ip_local_out net/ipv4/ip_output.c:126 [inline]
 __ip_queue_xmit+0x11b1/0x1b60 net/ipv4/ip_output.c:532
 __tcp_transmit_skb+0x1e33/0x33a0 net/ipv4/tcp_output.c:1403
 tcp_rcv_synsent_state_process net/ipv4/tcp_input.c:6378 [inline]
 tcp_rcv_state_process+0x2e28/0x4580 net/ipv4/tcp_input.c:6555
 tcp_v4_do_rcv+0x729/0xb00 net/ipv4/tcp_ipv4.c:1703
 sk_backlog_rcv include/net/sock.h:1117 [inline]
 __release_sock+0x198/0x4b0 net/core/sock.c:2936
 release_sock+0x5d/0x1c0 net/core/sock.c:3500
 inet_stream_connect+0x84/0xa0 net/ipv4/af_inet.c:742
 mptcp_connect+0x529/0x870 net/mptcp/protocol.c:3781
 __inet_stream_connect+0x254/0xf10 net/ipv4/af_inet.c:670
 inet_stream_connect+0x61/0xa0 net/ipv4/af_inet.c:741
 __sys_connect_file net/socket.c:2006 [inline]
 __sys_connect+0x2c9/0x300 net/socket.c:2023
 __do_sys_connect net/socket.c:2033 [inline]
 __se_sys_connect net/socket.c:2030 [inline]
 __x64_sys_connect+0x76/0x80 net/socket.c:2030
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7fde3bf7def9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fde3cdeb038 EFLAGS: 00000246 ORIG_RAX: 000000000000002a
RAX: ffffffffffffffda RBX: 00007fde3c135f80 RCX: 00007fde3bf7def9
RDX: 0000000000000010 RSI: 0000000020000000 RDI: 0000000000000004
RBP: 00007fde3bff0b76 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007fde3c135f80 R15: 00007fffed527788
 </TASK>

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/09/17 04:58 linux-6.1.y 5f55cad62cc9 c673ca06 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in sk_clone_lock
* Struck through repros no longer work on HEAD.