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: 137d, last: 14h47m
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 2483d 2488d 4/28 fixed on 2018/02/04 23:45
android-49 possible deadlock in do_ip_getsockopt 4 2330d 2366d 0/3 auto-closed as invalid on 2019/02/22 14:29
upstream possible deadlock in do_ip_getsockopt (2) netfilter 206 2461d 2476d 4/28 fixed on 2018/02/26 20:04

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.12.0-syzkaller-01518-ga5c93bfec0be #0 Not tainted
------------------------------------------------------
syz.2.7366/12756 is trying to acquire lock:
ffffffff8fcdbcc8 (rtnl_mutex){+.+.}-{4:4}, at: do_ip_getsockopt+0x10f5/0x2940 net/ipv4/ip_sockglue.c:1702

but task is already holding lock:
ffff888071dbad28 (&smc->clcsock_release_lock){+.+.}-{4:4}, at: smc_getsockopt+0x144/0x3e0 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){+.+.}-{4:4}:
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5849
       __mutex_lock_common kernel/locking/mutex.c:585 [inline]
       __mutex_lock+0x1ac/0xee0 kernel/locking/mutex.c:735
       smc_switch_to_fallback+0x35/0xdb0 net/smc/af_smc.c:902
       smc_sendmsg+0x11f/0x530 net/smc/af_smc.c:2771
       sock_sendmsg_nosec net/socket.c:711 [inline]
       __sock_sendmsg+0x221/0x270 net/socket.c:726
       __sys_sendto+0x363/0x4c0 net/socket.c:2195
       __do_sys_sendto net/socket.c:2202 [inline]
       __se_sys_sendto net/socket.c:2198 [inline]
       __x64_sys_sendto+0xde/0x100 net/socket.c:2198
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #1 (sk_lock-AF_INET){+.+.}-{0:0}:
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5849
       lock_sock_nested+0x48/0x100 net/core/sock.c:3617
       do_ip_setsockopt+0x1a2d/0x3cd0 net/ipv4/ip_sockglue.c:1078
       ip_setsockopt+0x63/0x100 net/ipv4/ip_sockglue.c:1417
       do_sock_setsockopt+0x3af/0x720 net/socket.c:2311
       __sys_setsockopt net/socket.c:2336 [inline]
       __do_sys_setsockopt net/socket.c:2342 [inline]
       __se_sys_setsockopt net/socket.c:2339 [inline]
       __x64_sys_setsockopt+0x1ee/0x280 net/socket.c:2339
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #0 (rtnl_mutex){+.+.}-{4:4}:
       check_prev_add kernel/locking/lockdep.c:3161 [inline]
       check_prevs_add kernel/locking/lockdep.c:3280 [inline]
       validate_chain+0x18ef/0x5920 kernel/locking/lockdep.c:3904
       __lock_acquire+0x1397/0x2100 kernel/locking/lockdep.c:5226
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5849
       __mutex_lock_common kernel/locking/mutex.c:585 [inline]
       __mutex_lock+0x1ac/0xee0 kernel/locking/mutex.c:735
       do_ip_getsockopt+0x10f5/0x2940 net/ipv4/ip_sockglue.c:1702
       ip_getsockopt+0xed/0x2e0 net/ipv4/ip_sockglue.c:1765
       tcp_getsockopt+0x163/0x1c0 net/ipv4/tcp.c:4670
       smc_getsockopt+0x1d9/0x3e0 net/smc/af_smc.c:3146
       do_sock_getsockopt+0x3c4/0x7e0 net/socket.c:2372
       __sys_getsockopt net/socket.c:2401 [inline]
       __do_sys_getsockopt net/socket.c:2408 [inline]
       __se_sys_getsockopt net/socket.c:2405 [inline]
       __x64_sys_getsockopt+0x2a1/0x370 net/socket.c:2405
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xf3/0x230 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.7366/12756:
 #0: ffff888071dbad28 (&smc->clcsock_release_lock){+.+.}-{4:4}, at: smc_getsockopt+0x144/0x3e0 net/smc/af_smc.c:3136

stack backtrace:
CPU: 0 UID: 0 PID: 12756 Comm: syz.2.7366 Not tainted 6.12.0-syzkaller-01518-ga5c93bfec0be #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/30/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
 print_circular_bug+0x13a/0x1b0 kernel/locking/lockdep.c:2074
 check_noncircular+0x36a/0x4a0 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+0x18ef/0x5920 kernel/locking/lockdep.c:3904
 __lock_acquire+0x1397/0x2100 kernel/locking/lockdep.c:5226
 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5849
 __mutex_lock_common kernel/locking/mutex.c:585 [inline]
 __mutex_lock+0x1ac/0xee0 kernel/locking/mutex.c:735
 do_ip_getsockopt+0x10f5/0x2940 net/ipv4/ip_sockglue.c:1702
 ip_getsockopt+0xed/0x2e0 net/ipv4/ip_sockglue.c:1765
 tcp_getsockopt+0x163/0x1c0 net/ipv4/tcp.c:4670
 smc_getsockopt+0x1d9/0x3e0 net/smc/af_smc.c:3146
 do_sock_getsockopt+0x3c4/0x7e0 net/socket.c:2372
 __sys_getsockopt net/socket.c:2401 [inline]
 __do_sys_getsockopt net/socket.c:2408 [inline]
 __se_sys_getsockopt net/socket.c:2405 [inline]
 __x64_sys_getsockopt+0x2a1/0x370 net/socket.c:2405
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f9297f7e759
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:00007f9298d7e038 EFLAGS: 00000246 ORIG_RAX: 0000000000000037
RAX: ffffffffffffffda RBX: 00007f9298135f80 RCX: 00007f9297f7e759
RDX: 0000000000000030 RSI: 0000000000000000 RDI: 0000000000000004
RBP: 00007f9297ff175e R08: 0000000020000040 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f9298135f80 R15: 00007f929825fa28
 </TASK>
netlink: 32 bytes leftover after parsing attributes in process `syz.2.7366'.

Crashes (524):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/11/20 06:17 upstream a5c93bfec0be 7d02db5a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce possible deadlock in do_ip_getsockopt
2024/11/20 02:42 upstream 158f238aa69d 7d02db5a .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/11/18 13:21 upstream adc218676eef e7bb5d6e .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/11/16 16:20 upstream e8bdb3c8be08 cfe3a04a .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/11/16 09:08 upstream f868cd251776 cfe3a04a .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/11/15 19:17 upstream cfaaa7d010d1 eeafb645 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/11/14 07:15 upstream 0a9b9d17f3a7 a8c99394 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/11/13 11:10 upstream 3022e9d00ebe 62026c85 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in do_ip_getsockopt
2024/11/12 07:13 upstream 2d5404caa8c7 75bb1b32 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/11/10 01:37 upstream da4373fbcf00 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in do_ip_getsockopt
2024/11/09 20:51 upstream da4373fbcf00 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/11/09 18:49 upstream da4373fbcf00 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/11/08 09:36 upstream 906bd684e4b1 179b040e .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/11/07 11:20 upstream 7758b206117d df3dc63b .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/11/06 17:30 upstream 2e1b3cc9d7f7 7b852900 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/11/05 13:15 upstream 2e1b3cc9d7f7 509da429 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce possible deadlock in do_ip_getsockopt
2024/11/04 18:26 upstream 59b723cd2adb 509da429 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce possible deadlock in do_ip_getsockopt
2024/11/04 07:22 upstream b9021de3ec2f f00eed24 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in do_ip_getsockopt
2024/11/03 06:26 upstream 3e5e6c9900c3 f00eed24 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/11/03 03:40 upstream 11066801dd4b f00eed24 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/11/03 00:50 upstream 11066801dd4b f00eed24 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/11/02 23:31 upstream 11066801dd4b f00eed24 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/11/02 22:28 upstream 11066801dd4b f00eed24 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/11/02 21:18 upstream 11066801dd4b f00eed24 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_getsockopt
2024/11/18 00:26 upstream f66d6acccbc0 cfe3a04a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-386 possible deadlock in do_ip_getsockopt
2024/11/06 13:18 upstream 2e1b3cc9d7f7 7b852900 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in do_ip_getsockopt
2024/11/06 07:21 upstream 2e1b3cc9d7f7 3a465482 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in do_ip_getsockopt
2024/11/06 04:32 upstream 2e1b3cc9d7f7 3a465482 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in do_ip_getsockopt
2024/10/19 04:02 upstream b04ae0f45168 cd6fc0a3 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in do_ip_getsockopt
2024/11/20 15:41 net 66418447d27b 4fca1650 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in do_ip_getsockopt
2024/11/19 18:59 net 66418447d27b 571351cb .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in do_ip_getsockopt
2024/11/19 09:31 net 4262bacb748f 571351cb .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in do_ip_getsockopt
2024/11/17 22:33 net 8ffade77b633 cfe3a04a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in do_ip_getsockopt
2024/11/17 02:09 net 8ffade77b633 cfe3a04a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in do_ip_getsockopt
2024/11/12 14:50 net 073d89808c06 75bb1b32 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in do_ip_getsockopt
2024/11/12 12:52 net 073d89808c06 75bb1b32 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in do_ip_getsockopt
2024/11/12 03:57 net 073d89808c06 75bb1b32 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in do_ip_getsockopt
2024/11/11 22:44 net 252e01e68241 97fe5517 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in do_ip_getsockopt
2024/11/11 22:04 net 252e01e68241 97fe5517 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in do_ip_getsockopt
2024/11/11 19:35 net 252e01e68241 97fe5517 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in do_ip_getsockopt
2024/11/11 12:27 net 252e01e68241 97fe5517 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in do_ip_getsockopt
2024/11/11 05:52 net 252e01e68241 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in do_ip_getsockopt
2024/11/11 04:05 net 252e01e68241 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in do_ip_getsockopt
2024/11/10 23:37 net 252e01e68241 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in do_ip_getsockopt
2024/11/10 18:36 net 252e01e68241 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in do_ip_getsockopt
2024/11/10 16:02 net 252e01e68241 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in do_ip_getsockopt
2024/11/10 06:00 net eb72e7fcc839 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in do_ip_getsockopt
2024/11/10 04:54 net eb72e7fcc839 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in do_ip_getsockopt
2024/11/08 21:54 net 55d42a0c3f9c 179b040e .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in do_ip_getsockopt
2024/11/08 11:21 net 55d42a0c3f9c 179b040e .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in do_ip_getsockopt
2024/11/05 06:38 net 249cfa318fb1 509da429 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in do_ip_getsockopt
2024/11/16 17:25 net-next 38f83a57aa8e cfe3a04a .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.