syzbot


possible deadlock in sockopt_lock_sock

Status: upstream: reported on 2024/08/15 10:13
Subsystems: net
[Documentation on labels]
Reported-by: syzbot+819a360379cf16b5f0d3@syzkaller.appspotmail.com
First crash: 40d, last: 5h41m
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [net?] possible deadlock in sockopt_lock_sock 0 (1) 2024/08/15 10:13

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.11.0-syzkaller-05778-g176000734ee2 #0 Not tainted
------------------------------------------------------
syz.0.710/8162 is trying to acquire lock:
ffff88806ac82458 (sk_lock-AF_INET){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1609 [inline]
ffff88806ac82458 (sk_lock-AF_INET){+.+.}-{0:0}, at: sockopt_lock_sock net/core/sock.c:1125 [inline]
ffff88806ac82458 (sk_lock-AF_INET){+.+.}-{0:0}, at: sockopt_lock_sock+0x54/0x70 net/core/sock.c:1116

but task is already holding lock:
ffffffff8fab2f28 (rtnl_mutex){+.+.}-{3:3}, at: do_ip_setsockopt+0xf9/0x38c0 net/ipv4/ip_sockglue.c:1077

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (rtnl_mutex){+.+.}-{3:3}:
       __mutex_lock_common kernel/locking/mutex.c:608 [inline]
       __mutex_lock+0x175/0x9c0 kernel/locking/mutex.c:752
       do_ipv6_setsockopt+0x1f4d/0x4800 net/ipv6/ipv6_sockglue.c:566
       ipv6_setsockopt+0xcb/0x170 net/ipv6/ipv6_sockglue.c:993
       tcp_setsockopt+0xa4/0x100 net/ipv4/tcp.c:4029
       smc_setsockopt+0x1b4/0xc00 net/smc/af_smc.c:3064
       do_sock_setsockopt+0x222/0x480 net/socket.c:2330
       __sys_setsockopt+0x1a4/0x270 net/socket.c:2353
       __do_sys_setsockopt net/socket.c:2362 [inline]
       __se_sys_setsockopt net/socket.c:2359 [inline]
       __x64_sys_setsockopt+0xbd/0x160 net/socket.c:2359
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #1 (&smc->clcsock_release_lock){+.+.}-{3:3}:
       __mutex_lock_common kernel/locking/mutex.c:608 [inline]
       __mutex_lock+0x175/0x9c0 kernel/locking/mutex.c:752
       smc_switch_to_fallback+0x2d/0xa00 net/smc/af_smc.c:902
       smc_sendmsg+0x13d/0x520 net/smc/af_smc.c:2771
       sock_sendmsg_nosec net/socket.c:730 [inline]
       __sock_sendmsg net/socket.c:745 [inline]
       ____sys_sendmsg+0x9ae/0xb40 net/socket.c:2603
       ___sys_sendmsg+0x135/0x1e0 net/socket.c:2657
       __sys_sendmsg+0x117/0x1f0 net/socket.c:2686
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #0 (sk_lock-AF_INET){+.+.}-{0:0}:
       check_prev_add kernel/locking/lockdep.c:3158 [inline]
       check_prevs_add kernel/locking/lockdep.c:3277 [inline]
       validate_chain kernel/locking/lockdep.c:3901 [inline]
       __lock_acquire+0x250b/0x3ce0 kernel/locking/lockdep.c:5199
       lock_acquire kernel/locking/lockdep.c:5822 [inline]
       lock_acquire+0x1b1/0x560 kernel/locking/lockdep.c:5787
       lock_sock_nested+0x3a/0xf0 net/core/sock.c:3611
       lock_sock include/net/sock.h:1609 [inline]
       sockopt_lock_sock net/core/sock.c:1125 [inline]
       sockopt_lock_sock+0x54/0x70 net/core/sock.c:1116
       do_ip_setsockopt+0x101/0x38c0 net/ipv4/ip_sockglue.c:1078
       ip_setsockopt+0x59/0xf0 net/ipv4/ip_sockglue.c:1417
       sctp_setsockopt+0x16a/0xb880 net/sctp/socket.c:4587
       do_sock_setsockopt+0x222/0x480 net/socket.c:2330
       __sys_setsockopt+0x1a4/0x270 net/socket.c:2353
       __do_sys_setsockopt net/socket.c:2362 [inline]
       __se_sys_setsockopt net/socket.c:2359 [inline]
       __x64_sys_setsockopt+0xbd/0x160 net/socket.c:2359
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

other info that might help us debug this:

Chain exists of:
  sk_lock-AF_INET --> &smc->clcsock_release_lock --> rtnl_mutex

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(rtnl_mutex);
                               lock(&smc->clcsock_release_lock);
                               lock(rtnl_mutex);
  lock(sk_lock-AF_INET);

 *** DEADLOCK ***

1 lock held by syz.0.710/8162:
 #0: ffffffff8fab2f28 (rtnl_mutex){+.+.}-{3:3}, at: do_ip_setsockopt+0xf9/0x38c0 net/ipv4/ip_sockglue.c:1077

stack backtrace:
CPU: 1 UID: 0 PID: 8162 Comm: syz.0.710 Not tainted 6.11.0-syzkaller-05778-g176000734ee2 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:93 [inline]
 dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:119
 print_circular_bug+0x419/0x5d0 kernel/locking/lockdep.c:2074
 check_noncircular+0x31a/0x400 kernel/locking/lockdep.c:2203
 check_prev_add kernel/locking/lockdep.c:3158 [inline]
 check_prevs_add kernel/locking/lockdep.c:3277 [inline]
 validate_chain kernel/locking/lockdep.c:3901 [inline]
 __lock_acquire+0x250b/0x3ce0 kernel/locking/lockdep.c:5199
 lock_acquire kernel/locking/lockdep.c:5822 [inline]
 lock_acquire+0x1b1/0x560 kernel/locking/lockdep.c:5787
 lock_sock_nested+0x3a/0xf0 net/core/sock.c:3611
 lock_sock include/net/sock.h:1609 [inline]
 sockopt_lock_sock net/core/sock.c:1125 [inline]
 sockopt_lock_sock+0x54/0x70 net/core/sock.c:1116
 do_ip_setsockopt+0x101/0x38c0 net/ipv4/ip_sockglue.c:1078
 ip_setsockopt+0x59/0xf0 net/ipv4/ip_sockglue.c:1417
 sctp_setsockopt+0x16a/0xb880 net/sctp/socket.c:4587
 do_sock_setsockopt+0x222/0x480 net/socket.c:2330
 __sys_setsockopt+0x1a4/0x270 net/socket.c:2353
 __do_sys_setsockopt net/socket.c:2362 [inline]
 __se_sys_setsockopt net/socket.c:2359 [inline]
 __x64_sys_setsockopt+0xbd/0x160 net/socket.c:2359
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f6ae937def9
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:00007f6aea08e038 EFLAGS: 00000246 ORIG_RAX: 0000000000000036
RAX: ffffffffffffffda RBX: 00007f6ae9535f80 RCX: 00007f6ae937def9
RDX: 0000000000000029 RSI: 0000000000000000 RDI: 0000000000000003
RBP: 00007f6ae93f0b76 R08: 0000000000000009 R09: 0000000000000000
R10: fffffffffffffffe R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f6ae9535f80 R15: 00007ffc50f39e58
 </TASK>

Crashes (65):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/09/20 21:47 upstream 176000734ee2 6f888b75 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in sockopt_lock_sock
2024/09/19 03:09 upstream a430d95c5efa c673ca06 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in sockopt_lock_sock
2024/09/19 01:13 upstream a430d95c5efa c673ca06 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in sockopt_lock_sock
2024/09/18 17:56 upstream a430d95c5efa c673ca06 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in sockopt_lock_sock
2024/09/18 16:41 upstream a430d95c5efa c673ca06 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in sockopt_lock_sock
2024/09/18 13:03 upstream a430d95c5efa c673ca06 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in sockopt_lock_sock
2024/09/18 10:29 upstream a430d95c5efa c673ca06 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in sockopt_lock_sock
2024/09/18 06:07 upstream a430d95c5efa c673ca06 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in sockopt_lock_sock
2024/09/17 23:43 upstream a430d95c5efa c673ca06 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in sockopt_lock_sock
2024/09/17 20:44 upstream a430d95c5efa c673ca06 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in sockopt_lock_sock
2024/09/17 16:35 upstream a430d95c5efa c673ca06 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in sockopt_lock_sock
2024/09/17 15:19 upstream a430d95c5efa c673ca06 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in sockopt_lock_sock
2024/09/17 08:27 upstream a430d95c5efa c673ca06 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in sockopt_lock_sock
2024/09/17 03:45 upstream a430d95c5efa c673ca06 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in sockopt_lock_sock
2024/09/17 02:04 upstream a430d95c5efa c673ca06 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in sockopt_lock_sock
2024/09/16 19:34 upstream adfc3ded5c33 49cf0773 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in sockopt_lock_sock
2024/09/16 18:22 upstream adfc3ded5c33 49cf0773 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in sockopt_lock_sock
2024/09/16 14:19 upstream adfc3ded5c33 49cf0773 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in sockopt_lock_sock
2024/09/16 14:02 upstream adfc3ded5c33 49cf0773 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in sockopt_lock_sock
2024/09/16 09:29 upstream a4ebad655b98 08d8a733 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in sockopt_lock_sock
2024/09/16 09:28 upstream a4ebad655b98 08d8a733 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in sockopt_lock_sock
2024/09/16 09:21 upstream a4ebad655b98 08d8a733 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in sockopt_lock_sock
2024/09/16 03:33 upstream 98f7e32f20d2 08d8a733 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in sockopt_lock_sock
2024/09/16 01:51 upstream 98f7e32f20d2 08d8a733 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in sockopt_lock_sock
2024/09/16 00:59 upstream 98f7e32f20d2 08d8a733 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in sockopt_lock_sock
2024/09/15 20:02 upstream 98f7e32f20d2 08d8a733 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in sockopt_lock_sock
2024/09/15 19:58 upstream 98f7e32f20d2 08d8a733 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in sockopt_lock_sock
2024/09/15 12:02 upstream 0babf683783d 08d8a733 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in sockopt_lock_sock
2024/09/15 03:42 upstream 0babf683783d 08d8a733 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in sockopt_lock_sock
2024/09/14 22:36 upstream 57719771a244 08d8a733 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in sockopt_lock_sock
2024/09/14 22:30 upstream 57719771a244 08d8a733 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in sockopt_lock_sock
2024/09/14 05:49 upstream b7718454f937 ff60e2ca .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in sockopt_lock_sock
2024/09/14 05:46 upstream b7718454f937 ff60e2ca .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in sockopt_lock_sock
2024/09/14 05:46 upstream b7718454f937 ff60e2ca .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in sockopt_lock_sock
2024/09/14 00:07 upstream 196145c606d0 b58f933c .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in sockopt_lock_sock
2024/09/13 22:39 upstream 196145c606d0 b58f933c .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in sockopt_lock_sock
2024/09/09 02:43 upstream 89f5e14d05b4 9750182a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root possible deadlock in sockopt_lock_sock
2024/09/02 05:06 upstream c9f016e72b5c 1eda0d14 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root possible deadlock in sockopt_lock_sock
2024/09/01 10:27 upstream 431c1646e1f8 1eda0d14 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root possible deadlock in sockopt_lock_sock
2024/08/26 01:09 upstream 5be63fc19fca d7d32352 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root possible deadlock in sockopt_lock_sock
2024/08/22 14:18 upstream 872cf28b8df9 295a4b50 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in sockopt_lock_sock
2024/08/20 09:40 upstream 6e4436539ae1 9f0ab3fb .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in sockopt_lock_sock
2024/08/17 10:53 upstream e5fa841af679 dbc93b08 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in sockopt_lock_sock
2024/08/12 00:54 upstream cb2e5ee8e7a0 6f4edef4 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root possible deadlock in sockopt_lock_sock
2024/08/11 23:16 upstream cb2e5ee8e7a0 6f4edef4 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root possible deadlock in sockopt_lock_sock
2024/08/11 15:25 upstream 5189dafa4cf9 6f4edef4 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root possible deadlock in sockopt_lock_sock
2024/09/09 00:35 upstream 5dadc1be8fc5 9750182a .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in sockopt_lock_sock
2024/09/09 00:35 upstream 5dadc1be8fc5 9750182a .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in sockopt_lock_sock
2024/09/09 00:35 upstream 5dadc1be8fc5 9750182a .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in sockopt_lock_sock
2024/08/26 13:24 upstream 5be63fc19fca 9aee4e0b .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in sockopt_lock_sock
2024/08/26 13:23 upstream 5be63fc19fca 9aee4e0b .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in sockopt_lock_sock
2024/08/26 13:22 upstream 5be63fc19fca 9aee4e0b .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in sockopt_lock_sock
2024/09/12 10:17 upstream 7c6a3a65ace7 d94c83d8 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in sockopt_lock_sock
2024/09/09 00:08 upstream 5dadc1be8fc5 9750182a .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in sockopt_lock_sock
2024/09/09 00:08 upstream 5dadc1be8fc5 9750182a .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in sockopt_lock_sock
2024/08/12 12:04 upstream 7c626ce4bae1 1fef415f .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in sockopt_lock_sock
2024/08/12 02:43 upstream cb2e5ee8e7a0 6f4edef4 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in sockopt_lock_sock
2024/08/11 10:09 upstream 5189dafa4cf9 6f4edef4 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in sockopt_lock_sock
* Struck through repros no longer work on HEAD.