syzbot


possible deadlock in ip_mroute_setsockopt

Status: upstream: reported on 2024/07/10 15:21
Subsystems: net
[Documentation on labels]
Reported-by: syzbot+e227429f6fa77945d7e4@syzkaller.appspotmail.com
First crash: 94d, last: 2h05m
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [net?] possible deadlock in ip_mroute_setsockopt 0 (1) 2024/07/10 15:21

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.12.0-rc2-syzkaller-00291-g09f6b0c8904b #0 Not tainted
------------------------------------------------------
syz.3.3901/27802 is trying to acquire lock:
ffffffff8fac34a8 (rtnl_mutex){+.+.}-{3:3}, at: ip_mroute_setsockopt+0x121/0x15c0 net/ipv4/ipmr.c:1370

but task is already holding lock:
ffff88807c787228 (&smc->clcsock_release_lock){+.+.}-{3:3}, at: smc_setsockopt+0x101/0xc00 net/smc/af_smc.c:3056

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:2607
       ___sys_sendmsg+0x135/0x1e0 net/socket.c:2661
       __sys_sendmsg+0x117/0x1f0 net/socket.c:2690
       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_INET6){+.+.}-{0:0}:
       lock_sock_nested+0x3a/0xf0 net/core/sock.c:3611
       lock_sock include/net/sock.h:1611 [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
       ipv6_setsockopt+0x155/0x170 net/ipv6/ipv6_sockglue.c:988
       sctp_setsockopt+0x16a/0xb880 net/sctp/socket.c:4587
       do_sock_setsockopt+0x222/0x480 net/socket.c:2334
       __sys_setsockopt+0x1a4/0x270 net/socket.c:2357
       __do_sys_setsockopt net/socket.c:2366 [inline]
       __se_sys_setsockopt net/socket.c:2363 [inline]
       __x64_sys_setsockopt+0xbd/0x160 net/socket.c:2363
       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
       ip_mroute_setsockopt+0x121/0x15c0 net/ipv4/ipmr.c:1370
       do_ip_setsockopt+0x2e7/0x38c0 net/ipv4/ip_sockglue.c:948
       ip_setsockopt+0x59/0xf0 net/ipv4/ip_sockglue.c:1417
       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:2334
       __sys_setsockopt+0x1a4/0x270 net/socket.c:2357
       __do_sys_setsockopt net/socket.c:2366 [inline]
       __se_sys_setsockopt net/socket.c:2363 [inline]
       __x64_sys_setsockopt+0xbd/0x160 net/socket.c:2363
       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_INET6 --> &smc->clcsock_release_lock

 Possible unsafe locking scenario:

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

 *** DEADLOCK ***

1 lock held by syz.3.3901/27802:
 #0: ffff88807c787228 (&smc->clcsock_release_lock){+.+.}-{3:3}, at: smc_setsockopt+0x101/0xc00 net/smc/af_smc.c:3056

stack backtrace:
CPU: 0 UID: 0 PID: 27802 Comm: syz.3.3901 Not tainted 6.12.0-rc2-syzkaller-00291-g09f6b0c8904b #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
 ip_mroute_setsockopt+0x121/0x15c0 net/ipv4/ipmr.c:1370
 do_ip_setsockopt+0x2e7/0x38c0 net/ipv4/ip_sockglue.c:948
 ip_setsockopt+0x59/0xf0 net/ipv4/ip_sockglue.c:1417
 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:2334
 __sys_setsockopt+0x1a4/0x270 net/socket.c:2357
 __do_sys_setsockopt net/socket.c:2366 [inline]
 __se_sys_setsockopt net/socket.c:2363 [inline]
 __x64_sys_setsockopt+0xbd/0x160 net/socket.c:2363
 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:0x7f499f57dff9
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:00007f49a043f038 EFLAGS: 00000246 ORIG_RAX: 0000000000000036
RAX: ffffffffffffffda RBX: 00007f499f735f80 RCX: 00007f499f57dff9
RDX: 00100000000000c8 RSI: 0000000000000000 RDI: 0000000000000003
RBP: 00007f499f5f0296 R08: 0000000000000028 R09: 0000000000000000
R10: ffffffffff600000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f499f735f80 R15: 00007ffea386edc8
 </TASK>

Crashes (240):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/10/12 14:06 upstream 09f6b0c8904b 084d8178 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/10/12 00:46 upstream 9e4c6c1ad9a1 084d8178 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/10/11 17:59 upstream 1d227fcc7222 5e7b4bca .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/10/11 08:14 upstream 1d227fcc7222 cd942402 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/10/11 04:59 upstream 1d227fcc7222 cd942402 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/10/10 17:29 upstream d3d1556696c1 a156c552 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/10/10 03:18 upstream b983b271662b 0278d004 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/10/08 17:28 upstream 87d6aab2389e 402f1df0 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/10/08 04:10 upstream 87d6aab2389e 402f1df0 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/10/08 01:24 upstream 87d6aab2389e 402f1df0 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/10/07 18:44 upstream 8cf0b93919e1 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/10/07 14:45 upstream 8cf0b93919e1 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/10/06 16:25 upstream 8f602276d390 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/10/06 14:01 upstream 8f602276d390 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/10/06 03:01 upstream fc20a3e57247 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/10/05 22:06 upstream fc20a3e57247 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/10/05 19:49 upstream fc20a3e57247 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/10/05 14:25 upstream 27cc6fdf7201 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/10/05 13:07 upstream 27cc6fdf7201 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/10/05 08:28 upstream 27cc6fdf7201 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/10/04 23:34 upstream 0c559323bbaa d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/10/04 08:39 upstream 3840cbe24cf0 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/10/03 10:28 upstream f23aa4c0761a a4c7fd36 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/10/03 06:44 upstream f23aa4c0761a a4c7fd36 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/10/03 05:27 upstream f23aa4c0761a a4c7fd36 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/10/02 23:43 upstream f23aa4c0761a a4c7fd36 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/10/02 12:50 upstream e32cde8d2bd7 83a2f15f .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/10/02 11:17 upstream e32cde8d2bd7 83a2f15f .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/10/02 10:24 upstream e32cde8d2bd7 ea2b66a6 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/10/02 08:17 upstream e32cde8d2bd7 ea2b66a6 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/10/01 19:01 upstream e32cde8d2bd7 e9f6e118 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/09/30 14:05 upstream 9852d85ec9d4 179f4029 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/09/30 07:41 upstream e7ed34365879 ba29ff75 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce possible deadlock in ip_mroute_setsockopt
2024/09/30 02:09 upstream e7ed34365879 ba29ff75 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/09/29 18:37 upstream e7ed34365879 ba29ff75 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/09/29 13:53 upstream 3efc57369a0c ba29ff75 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/09/29 10:17 upstream 3efc57369a0c ba29ff75 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/09/29 07:37 upstream 3efc57369a0c ba29ff75 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/09/29 06:22 upstream 3efc57369a0c ba29ff75 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/09/28 17:16 upstream ad46e8f95e93 ba29ff75 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/09/28 13:47 upstream ad46e8f95e93 ba29ff75 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/09/28 04:56 upstream e477dba5442c 440b26ec .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/09/27 20:11 upstream e477dba5442c 2b1784d6 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/09/27 13:06 upstream 075dbe9f6e3c 2b1784d6 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/09/26 12:49 upstream 11a299a7933e 9314348a .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/09/11 03:48 upstream 8d8d276ba2fb 79eef296 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in ip_mroute_setsockopt
2024/09/11 01:25 upstream 8d8d276ba2fb 79eef296 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in ip_mroute_setsockopt
2024/08/26 03:57 upstream 5be63fc19fca d7d32352 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root possible deadlock in ip_mroute_setsockopt
2024/09/08 07:09 upstream d1f2d51b711a 9750182a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-386 possible deadlock in ip_mroute_setsockopt
2024/08/10 01:42 upstream afdab700f65e 6f4edef4 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in ip_mroute_setsockopt
2024/10/09 18:00 upstream 75b607fab38d 56fb2cb7 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in ip_mroute_setsockopt
2024/09/08 22:41 net d759ee240d3c 9750182a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in ip_mroute_setsockopt
2024/10/03 17:28 net-next 7c2f1c2690a5 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in ip_mroute_setsockopt
2024/09/26 07:51 net-next 151ac45348af 0d19f247 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in ip_mroute_setsockopt
2024/09/25 21:02 net-next 151ac45348af 349a68c4 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in ip_mroute_setsockopt
2024/09/25 03:04 net-next 151ac45348af 5643e0e9 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in ip_mroute_setsockopt
2024/07/10 06:40 net-next 40ab9e0dc865 79d68ada .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in ip_mroute_setsockopt
* Struck through repros no longer work on HEAD.