syzbot


possible deadlock in do_ip_setsockopt (4)

Status: upstream: reported C repro on 2024/06/26 09:50
Subsystems: net
[Documentation on labels]
Reported-by: syzbot+e4c27043b9315839452d@syzkaller.appspotmail.com
First crash: 166d, last: 1h10m
Cause bisection: introduced by (bisect log) :
commit d25a92ccae6bed02327b63d138e12e7806830f78
Author: D. Wythe <alibuda@linux.alibaba.com>
Date: Thu Jun 13 18:00:30 2024 +0000

  net/smc: Introduce IPPROTO_SMC

Crash: possible deadlock in do_ip_setsockopt (log)
Repro: C syz .config
  
Discussions (6)
Title Replies (including bot) Last reply
[syzbot] Monthly net report (Dec 2024) 0 (1) 2024/12/05 09:04
[syzbot] Monthly net report (Nov 2024) 0 (1) 2024/11/04 08:49
[PATCH] net/ipv4: Fix circular deadlock in do_ip_setsockop 4 (4) 2024/09/22 21:04
Re: [syzbot] [PATCH] net/ipv4: Fixing circular deadlock 0 (1) 2024/09/17 22:57
[syzbot] [net?] possible deadlock in do_ip_setsockopt (4) 3 (8) 2024/09/17 22:31
[syzbot] Monthly net report (Sep 2024) 0 (1) 2024/09/02 08:21
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in do_ip_setsockopt netfilter C 467 2496d 2504d 0/28 closed as dup on 2018/01/30 13:58
upstream possible deadlock in do_ip_setsockopt (2) netfilter 59 2493d 2496d 4/28 fixed on 2018/02/07 13:26
android-49 possible deadlock in do_ip_setsockopt C 101 2307d 2065d 0/3 public: reported C repro on 2019/04/11 08:44
upstream possible deadlock in do_ip_setsockopt (3) netfilter 3731 2476d 2493d 4/28 fixed on 2018/02/26 20:04
Last patch testing requests (3)
Created Duration User Patch Repo Result
2024/09/17 22:57 25m srikarananta01@gmail.com patch upstream OK log
2024/09/17 21:58 3m srikarananta01@gmail.com patch upstream error
2024/09/17 21:11 15m srikarananta01@gmail.com git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 2f27fce67173bbb05d5a0ee03dae5c021202c912 report log

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.11.0-rc4-syzkaller-00255-gd2bafcf224f3 #0 Not tainted
------------------------------------------------------
syz-executor266/5220 is trying to acquire lock:
ffff888017752958 (sk_lock-AF_INET){+.+.}-{0:0}, at: do_ip_setsockopt+0x1a2d/0x3cd0 net/ipv4/ip_sockglue.c:1078

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

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (rtnl_mutex){+.+.}-{3:3}:
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5759
       __mutex_lock_common kernel/locking/mutex.c:608 [inline]
       __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752
       smc_vlan_by_tcpsk+0x399/0x4e0 net/smc/smc_core.c:1853
       __smc_connect+0x2a4/0x1890 net/smc/af_smc.c:1522
       smc_connect+0x868/0xde0 net/smc/af_smc.c:1702
       __sys_connect_file net/socket.c:2061 [inline]
       __sys_connect+0x2df/0x310 net/socket.c:2078
       __do_sys_connect net/socket.c:2088 [inline]
       __se_sys_connect net/socket.c:2085 [inline]
       __x64_sys_connect+0x7a/0x90 net/socket.c:2085
       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 (sk_lock-AF_INET){+.+.}-{0:0}:
       check_prev_add kernel/locking/lockdep.c:3133 [inline]
       check_prevs_add kernel/locking/lockdep.c:3252 [inline]
       validate_chain+0x18e0/0x5900 kernel/locking/lockdep.c:3868
       __lock_acquire+0x137a/0x2040 kernel/locking/lockdep.c:5142
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5759
       lock_sock_nested+0x48/0x100 net/core/sock.c:3543
       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:2324
       __sys_setsockopt+0x1ae/0x250 net/socket.c:2347
       __do_sys_setsockopt net/socket.c:2356 [inline]
       __se_sys_setsockopt net/socket.c:2353 [inline]
       __x64_sys_setsockopt+0xb5/0xd0 net/socket.c:2353
       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:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(rtnl_mutex);
                               lock(sk_lock-AF_INET);
                               lock(rtnl_mutex);
  lock(sk_lock-AF_INET);

 *** DEADLOCK ***

1 lock held by syz-executor266/5220:
 #0: ffffffff8fa72248 (rtnl_mutex){+.+.}-{3:3}, at: do_ip_setsockopt+0x127d/0x3cd0 net/ipv4/ip_sockglue.c:1077

stack backtrace:
CPU: 1 UID: 0 PID: 5220 Comm: syz-executor266 Not tainted 6.11.0-rc4-syzkaller-00255-gd2bafcf224f3 #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+0x241/0x360 lib/dump_stack.c:119
 check_noncircular+0x36a/0x4a0 kernel/locking/lockdep.c:2186
 check_prev_add kernel/locking/lockdep.c:3133 [inline]
 check_prevs_add kernel/locking/lockdep.c:3252 [inline]
 validate_chain+0x18e0/0x5900 kernel/locking/lockdep.c:3868
 __lock_acquire+0x137a/0x2040 kernel/locking/lockdep.c:5142
 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5759
 lock_sock_nested+0x48/0x100 net/core/sock.c:3543
 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:2324
 __sys_setsockopt+0x1ae/0x250 net/socket.c:2347
 __do_sys_setsockopt net/socket.c:2356 [inline]
 __se_sys_setsockopt net/socket.c:2353 [inline]
 __x64_sys_setsockopt+0xb5/0xd0 net/socket.c:2353
 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:0x7f9dbe0ada79
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 c1 17 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffcf0f564e8 EFLAGS: 00000246 ORIG_RAX: 0000000000000036
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f9dbe0ada79
RDX: 0000000000000023 RSI: 0000000000000000 RDI: 0000000000000004
RBP: 00007f9dbe1205f0 R08: 0000000000000000 R09: 0000000000000006
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
R13: 431bde82d7b634db R14: 0000000000000001 R15: 0000000000000001
 </TASK>

Crashes (4961):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/08/24 16:47 upstream d2bafcf224f3 d7d32352 .config strace log report syz / log C [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in do_ip_setsockopt
2024/12/06 04:47 upstream 5076001689e4 946d28f0 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce possible deadlock in do_ip_setsockopt
2024/12/05 11:46 upstream feffde684ac2 29f61fce .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in do_ip_setsockopt
2024/12/05 10:45 upstream feffde684ac2 29f61fce .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in do_ip_setsockopt
2024/12/04 17:23 upstream feffde684ac2 b50eb251 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_setsockopt
2024/12/03 22:29 upstream ceb8bf2ceaa7 578925bc .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce possible deadlock in do_ip_setsockopt
2024/12/02 13:14 upstream e70140ba0d2b b499ea68 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_setsockopt
2024/12/01 21:03 upstream bcc8eda6d349 68914665 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce possible deadlock in do_ip_setsockopt
2024/12/01 18:58 upstream bcc8eda6d349 68914665 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_setsockopt
2024/12/01 17:56 upstream bcc8eda6d349 68914665 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_setsockopt
2024/12/01 10:53 upstream bcc8eda6d349 68914665 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in do_ip_setsockopt
2024/11/19 20:19 upstream 158f238aa69d 571351cb .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in do_ip_setsockopt
2024/11/15 04:17 upstream cfaaa7d010d1 f6ede3a3 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in do_ip_setsockopt
2024/08/30 07:45 upstream d5d547aa7b51 54fe8471 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root possible deadlock in do_ip_setsockopt
2024/12/03 15:03 upstream cdd30ebb1b9f 578925bc .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-386 possible deadlock in do_ip_setsockopt
2024/12/02 08:58 upstream e70140ba0d2b 68914665 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-386 possible deadlock in do_ip_setsockopt
2024/11/13 11:09 upstream 3022e9d00ebe 62026c85 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in do_ip_setsockopt
2024/10/15 06:59 upstream eca631b8fe80 b01b6661 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in do_ip_setsockopt
2024/12/06 07:31 net 896d8946da97 946d28f0 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in do_ip_setsockopt
2024/12/06 06:57 net 896d8946da97 946d28f0 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in do_ip_setsockopt
2024/12/06 05:48 net 896d8946da97 946d28f0 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in do_ip_setsockopt
2024/12/06 03:18 net 896d8946da97 946d28f0 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in do_ip_setsockopt
2024/12/06 00:05 net 31f1b55d5d7e 6e50d07b .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in do_ip_setsockopt
2024/12/05 22:50 net 31f1b55d5d7e 6e50d07b .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in do_ip_setsockopt
2024/12/05 20:56 net 31f1b55d5d7e 6e50d07b .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in do_ip_setsockopt
2024/12/05 19:51 net 31f1b55d5d7e 6e50d07b .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in do_ip_setsockopt
2024/12/05 18:49 net 31f1b55d5d7e 6e50d07b .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in do_ip_setsockopt
2024/12/05 16:24 net 31f1b55d5d7e 6e50d07b .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in do_ip_setsockopt
2024/12/04 12:18 net af8edaeddbc5 b50eb251 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in do_ip_setsockopt
2024/12/06 01:12 net-next da4fa00abe56 6e50d07b .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in do_ip_setsockopt
2024/12/05 17:34 net-next da4fa00abe56 6e50d07b .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in do_ip_setsockopt
2024/12/05 16:25 net-next da4fa00abe56 6e50d07b .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in do_ip_setsockopt
2024/12/04 18:56 net-next bb18265c3aba b50eb251 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in do_ip_setsockopt
2024/12/04 10:27 net-next ebf7f7d61681 b50eb251 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in do_ip_setsockopt
2024/12/04 08:11 net-next ebf7f7d61681 b50eb251 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in do_ip_setsockopt
2024/12/04 06:34 net-next ebf7f7d61681 b50eb251 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in do_ip_setsockopt
2024/12/04 02:40 net-next ebf7f7d61681 b50eb251 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in do_ip_setsockopt
2024/12/03 13:32 net-next b32913a5609a 578925bc .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in do_ip_setsockopt
2024/12/03 05:21 net-next b32913a5609a 578925bc .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in do_ip_setsockopt
2024/12/03 04:20 net-next b32913a5609a 578925bc .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in do_ip_setsockopt
2024/12/03 00:10 net-next 65ae975e97d5 bb326ffb .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in do_ip_setsockopt
2024/12/02 22:54 net-next 65ae975e97d5 bb326ffb .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in do_ip_setsockopt
2024/12/02 17:21 net-next 65ae975e97d5 bb326ffb .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in do_ip_setsockopt
2024/12/02 12:08 net-next 65ae975e97d5 68914665 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in do_ip_setsockopt
2024/12/02 07:00 net-next 65ae975e97d5 68914665 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in do_ip_setsockopt
2024/12/02 04:26 net-next 65ae975e97d5 68914665 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in do_ip_setsockopt
2024/12/02 02:45 net-next 65ae975e97d5 68914665 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in do_ip_setsockopt
2024/12/01 23:26 net-next 65ae975e97d5 68914665 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in do_ip_setsockopt
2024/12/01 13:47 net-next 65ae975e97d5 68914665 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in do_ip_setsockopt
2024/12/01 09:32 net-next 65ae975e97d5 68914665 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in do_ip_setsockopt
2024/12/01 07:47 net-next 65ae975e97d5 68914665 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in do_ip_setsockopt
2024/12/01 05:28 net-next 65ae975e97d5 68914665 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in do_ip_setsockopt
2024/07/20 13:04 net-next 58f9416d413a b88348e9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-net-next-test-gce possible deadlock in do_ip_setsockopt
2024/06/26 02:51 net-next 73cfd947dbdb da0bd5ca .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in do_ip_setsockopt
2024/06/22 09:44 net-next 3226607302ca edc5149a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in do_ip_setsockopt
2024/12/01 02:42 linux-next f486c8aa16b8 68914665 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in do_ip_setsockopt
2024/12/01 00:44 linux-next f486c8aa16b8 68914665 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root possible deadlock in do_ip_setsockopt
2024/12/02 01:15 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 7b1d1d4cfac0 68914665 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 possible deadlock in do_ip_setsockopt
* Struck through repros no longer work on HEAD.