syzbot


possible deadlock in do_ip_getsockopt (3)

Status: upstream: reported on 2024/07/10 21:17
Subsystems: net
[Documentation on labels]
Reported-by: syzbot+aa5e39930997b0fe3dba@syzkaller.appspotmail.com
First crash: 91d, last: 5h20m
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [net?] possible deadlock in do_ip_getsockopt (3) 0 (1) 2024/07/10 21:17
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in do_ip_getsockopt netfilter 22 2437d 2442d 4/28 fixed on 2018/02/04 23:45
android-49 possible deadlock in do_ip_getsockopt 4 2284d 2320d 0/3 auto-closed as invalid on 2019/02/22 14:29
upstream possible deadlock in do_ip_getsockopt (2) netfilter 206 2415d 2430d 4/28 fixed on 2018/02/26 20:04

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.12.0-rc1-syzkaller-00125-g0c559323bbaa #0 Not tainted
------------------------------------------------------
syz.2.2457/17918 is trying to acquire lock:
ffffffff8fac2aa8 (rtnl_mutex){+.+.}-{3:3}, at: do_ip_getsockopt+0x1e06/0x2bf0 net/ipv4/ip_sockglue.c:1702

but task is already holding lock:
ffff88802f664fa8 (&smc->clcsock_release_lock){+.+.}-{3:3}, at: smc_getsockopt+0xbd/0x360 net/smc/af_smc.c:3136

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&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:729 [inline]
       __sock_sendmsg net/socket.c:744 [inline]
       ____sys_sendmsg+0x9ae/0xb40 net/socket.c:2602
       ___sys_sendmsg+0x135/0x1e0 net/socket.c:2656
       __sys_sendmsg+0x117/0x1f0 net/socket.c:2685
       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 (sk_lock-AF_INET){+.+.}-{0:0}:
       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
       raw_setsockopt+0xb8/0x290 net/ipv4/raw.c:845
       do_sock_setsockopt+0x222/0x480 net/socket.c:2329
       __sys_setsockopt+0x1a4/0x270 net/socket.c:2352
       __do_sys_setsockopt net/socket.c:2361 [inline]
       __se_sys_setsockopt net/socket.c:2358 [inline]
       __x64_sys_setsockopt+0xbd/0x160 net/socket.c:2358
       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 (rtnl_mutex){+.+.}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3161 [inline]
       check_prevs_add kernel/locking/lockdep.c:3280 [inline]
       validate_chain kernel/locking/lockdep.c:3904 [inline]
       __lock_acquire+0x250b/0x3ce0 kernel/locking/lockdep.c:5202
       lock_acquire.part.0+0x11b/0x380 kernel/locking/lockdep.c:5825
       __mutex_lock_common kernel/locking/mutex.c:608 [inline]
       __mutex_lock+0x175/0x9c0 kernel/locking/mutex.c:752
       do_ip_getsockopt+0x1e06/0x2bf0 net/ipv4/ip_sockglue.c:1702
       ip_getsockopt+0x9c/0x1e0 net/ipv4/ip_sockglue.c:1765
       ipv6_getsockopt+0x230/0x280 net/ipv6/ipv6_sockglue.c:1478
       tcp_getsockopt+0x9e/0x100 net/ipv4/tcp.c:4670
       smc_getsockopt+0x163/0x360 net/smc/af_smc.c:3146
       do_sock_getsockopt+0x3fe/0x870 net/socket.c:2391
       __sys_getsockopt+0x1a1/0x270 net/socket.c:2420
       __do_sys_getsockopt net/socket.c:2430 [inline]
       __se_sys_getsockopt net/socket.c:2427 [inline]
       __x64_sys_getsockopt+0xbd/0x160 net/socket.c:2427
       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:
  rtnl_mutex --> sk_lock-AF_INET --> &smc->clcsock_release_lock

 Possible unsafe locking scenario:

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

 *** DEADLOCK ***

1 lock held by syz.2.2457/17918:
 #0: ffff88802f664fa8 (&smc->clcsock_release_lock){+.+.}-{3:3}, at: smc_getsockopt+0xbd/0x360 net/smc/af_smc.c:3136

stack backtrace:
CPU: 0 UID: 0 PID: 17918 Comm: syz.2.2457 Not tainted 6.12.0-rc1-syzkaller-00125-g0c559323bbaa #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120
 print_circular_bug+0x419/0x5d0 kernel/locking/lockdep.c:2074
 check_noncircular+0x31a/0x400 kernel/locking/lockdep.c:2206
 check_prev_add kernel/locking/lockdep.c:3161 [inline]
 check_prevs_add kernel/locking/lockdep.c:3280 [inline]
 validate_chain kernel/locking/lockdep.c:3904 [inline]
 __lock_acquire+0x250b/0x3ce0 kernel/locking/lockdep.c:5202
 lock_acquire.part.0+0x11b/0x380 kernel/locking/lockdep.c:5825
 __mutex_lock_common kernel/locking/mutex.c:608 [inline]
 __mutex_lock+0x175/0x9c0 kernel/locking/mutex.c:752
 do_ip_getsockopt+0x1e06/0x2bf0 net/ipv4/ip_sockglue.c:1702
 ip_getsockopt+0x9c/0x1e0 net/ipv4/ip_sockglue.c:1765
 ipv6_getsockopt+0x230/0x280 net/ipv6/ipv6_sockglue.c:1478
 tcp_getsockopt+0x9e/0x100 net/ipv4/tcp.c:4670
 smc_getsockopt+0x163/0x360 net/smc/af_smc.c:3146
 do_sock_getsockopt+0x3fe/0x870 net/socket.c:2391
 __sys_getsockopt+0x1a1/0x270 net/socket.c:2420
 __do_sys_getsockopt net/socket.c:2430 [inline]
 __se_sys_getsockopt net/socket.c:2427 [inline]
 __x64_sys_getsockopt+0xbd/0x160 net/socket.c:2427
 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:0x7f25e5f7dff9
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:00007f25e6d01038 EFLAGS: 00000246 ORIG_RAX: 0000000000000037
RAX: ffffffffffffffda RBX: 00007f25e6135f80 RCX: 00007f25e5f7dff9
RDX: 0000000000000030 RSI: 0000000000000000 RDI: 0000000100000006
RBP: 00007f25e5ff0296 R08: 0000000000000000 R09: 0000000000000000
R10: 9999999999999999 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f25e6135f80 R15: 00007fffa6908fa8
 </TASK>

Crashes (374):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/10/05 02:59 upstream 0c559323bbaa d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/10/04 09:15 upstream 3840cbe24cf0 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/10/03 19:16 upstream 7ec462100ef9 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/10/02 15:21 upstream e32cde8d2bd7 83a2f15f .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/10/02 12:40 upstream e32cde8d2bd7 83a2f15f .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/10/02 06:51 upstream e32cde8d2bd7 ea2b66a6 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/10/02 01:26 upstream e32cde8d2bd7 ea2b66a6 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/10/01 08:15 upstream e32cde8d2bd7 bbd4e0a4 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/10/01 03:09 upstream e32cde8d2bd7 bbd4e0a4 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/09/30 17:15 upstream 9852d85ec9d4 179f4029 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/09/29 18:42 upstream e7ed34365879 ba29ff75 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/09/29 15:44 upstream 3efc57369a0c ba29ff75 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/09/29 13:20 upstream 3efc57369a0c ba29ff75 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/09/29 09:19 upstream 3efc57369a0c ba29ff75 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/09/29 05:19 upstream 3efc57369a0c ba29ff75 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/09/28 12:00 upstream ad46e8f95e93 ba29ff75 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/09/28 10:29 upstream e477dba5442c 440b26ec .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/09/28 09:22 upstream e477dba5442c 440b26ec .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/09/28 08:19 upstream e477dba5442c 440b26ec .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/09/28 07:17 upstream e477dba5442c 440b26ec .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/09/28 05:58 upstream e477dba5442c 440b26ec .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/09/28 04:48 upstream e477dba5442c 440b26ec .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/09/28 04:36 upstream e477dba5442c 440b26ec .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/09/28 02:53 upstream e477dba5442c 440b26ec .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/09/28 01:45 upstream e477dba5442c 440b26ec .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/09/28 01:21 upstream e477dba5442c 440b26ec .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/09/28 00:20 upstream e477dba5442c 440b26ec .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/09/27 23:53 upstream e477dba5442c 440b26ec .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/09/27 22:30 upstream e477dba5442c 2b1784d6 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/09/27 21:51 upstream e477dba5442c 2b1784d6 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/09/27 20:40 upstream e477dba5442c 2b1784d6 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/09/27 20:29 upstream e477dba5442c 2b1784d6 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/09/27 19:28 upstream e477dba5442c 2b1784d6 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/09/27 18:20 upstream e477dba5442c 2b1784d6 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/09/27 18:20 upstream e477dba5442c 2b1784d6 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/09/27 17:10 upstream 075dbe9f6e3c 2b1784d6 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/09/27 16:06 upstream 075dbe9f6e3c 2b1784d6 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/09/27 15:47 upstream 075dbe9f6e3c 2b1784d6 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/09/27 14:31 upstream 075dbe9f6e3c 2b1784d6 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/09/27 13:28 upstream 075dbe9f6e3c 2b1784d6 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/09/27 13:16 upstream 075dbe9f6e3c 2b1784d6 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/09/27 12:08 upstream 075dbe9f6e3c 2b1784d6 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/09/27 12:03 upstream 075dbe9f6e3c 2b1784d6 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/09/27 11:03 upstream 075dbe9f6e3c 2b1784d6 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/10/05 21:21 net 9234a2549cb6 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in do_ip_getsockopt
2024/09/23 02:27 net 7ebf44c91069 6f888b75 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in do_ip_getsockopt
2024/08/21 02:36 net-next 797653865b98 9f0ab3fb .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in do_ip_getsockopt
2024/07/06 21:07 linux-next 0b58e108042b bc4ebbb5 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in do_ip_getsockopt
2024/09/26 01:05 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 5f5673607153 349a68c4 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in do_ip_getsockopt
* Struck through repros no longer work on HEAD.