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: 133d, last: 12h14m
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-syzkaller-00233-g9fb2cfa4635a #0 Not tainted
------------------------------------------------------
syz.1.7441/7217 is trying to acquire lock:
ffffffff8fac8668 (rtnl_mutex){+.+.}-{3:3}, at: ip_mroute_setsockopt+0x121/0x15c0 net/ipv4/ipmr.c:1370

but task is already holding lock:
ffff88805a7b66a8 (&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:711 [inline]
       __sock_sendmsg net/socket.c:726 [inline]
       ____sys_sendmsg+0x9ae/0xb40 net/socket.c:2581
       ___sys_sendmsg+0x135/0x1e0 net/socket.c:2635
       __sys_sendmsg+0x16e/0x220 net/socket.c:2667
       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:3617
       lock_sock include/net/sock.h:1611 [inline]
       sockopt_lock_sock net/core/sock.c:1131 [inline]
       sockopt_lock_sock+0x54/0x70 net/core/sock.c:1122
       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:2311
       __sys_setsockopt+0x1a0/0x230 net/socket.c:2336
       __do_sys_setsockopt net/socket.c:2342 [inline]
       __se_sys_setsockopt net/socket.c:2339 [inline]
       __x64_sys_setsockopt+0xbd/0x160 net/socket.c:2339
       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:2311
       __sys_setsockopt+0x1a0/0x230 net/socket.c:2336
       __do_sys_setsockopt net/socket.c:2342 [inline]
       __se_sys_setsockopt net/socket.c:2339 [inline]
       __x64_sys_setsockopt+0xbd/0x160 net/socket.c:2339
       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.1.7441/7217:
 #0: ffff88805a7b66a8 (&smc->clcsock_release_lock){+.+.}-{3:3}, at: smc_setsockopt+0x101/0xc00 net/smc/af_smc.c:3056

stack backtrace:
CPU: 1 UID: 0 PID: 7217 Comm: syz.1.7441 Not tainted 6.12.0-syzkaller-00233-g9fb2cfa4635a #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+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:2311
 __sys_setsockopt+0x1a0/0x230 net/socket.c:2336
 __do_sys_setsockopt net/socket.c:2342 [inline]
 __se_sys_setsockopt net/socket.c:2339 [inline]
 __x64_sys_setsockopt+0xbd/0x160 net/socket.c:2339
 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:0x7f869557e759
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:00007f8696330038 EFLAGS: 00000246 ORIG_RAX: 0000000000000036
RAX: ffffffffffffffda RBX: 00007f8695735f80 RCX: 00007f869557e759
RDX: 00100000000000c8 RSI: 0000000000000000 RDI: 0000000000000003
RBP: 00007f86955f175e R08: 0000000000000028 R09: 0000000000000000
R10: ffffffffff600000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f8695735f80 R15: 00007fff17058c28
 </TASK>

Crashes (998):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/11/18 23:39 upstream 9fb2cfa4635a 571351cb .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/11/18 16:21 upstream adc218676eef e7bb5d6e .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/11/18 13:15 upstream adc218676eef e7bb5d6e .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/11/18 10:29 upstream adc218676eef e7bb5d6e .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/11/18 09:09 upstream adc218676eef cfe3a04a .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/11/17 23:53 upstream f66d6acccbc0 cfe3a04a .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/11/17 20:44 upstream f66d6acccbc0 cfe3a04a .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/11/15 22:12 upstream f868cd251776 f6ede3a3 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in ip_mroute_setsockopt
2024/11/15 14:13 upstream cfaaa7d010d1 eeafb645 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/11/15 09:07 upstream cfaaa7d010d1 f6ede3a3 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/11/15 02:55 upstream cfaaa7d010d1 f6ede3a3 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/11/15 00:08 upstream cfaaa7d010d1 77f3eeb7 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/11/14 18:04 upstream 0a9b9d17f3a7 77f3eeb7 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/11/14 15:03 upstream 0a9b9d17f3a7 77f3eeb7 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/11/14 11:05 upstream 0a9b9d17f3a7 a8c99394 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/11/14 06:33 upstream 0a9b9d17f3a7 a8c99394 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/11/14 03:46 upstream 0a9b9d17f3a7 a8c99394 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/11/13 19:32 upstream f1b785f4c787 4dfba277 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/11/13 15:21 upstream f1b785f4c787 4dfba277 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/11/13 05:02 upstream 3022e9d00ebe 62026c85 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/11/12 21:12 upstream 3022e9d00ebe c819f227 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/11/12 11:52 upstream 2d5404caa8c7 75bb1b32 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/11/12 08:17 upstream 2d5404caa8c7 75bb1b32 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/11/12 00:12 upstream 2d5404caa8c7 75bb1b32 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/11/11 18:09 upstream 2d5404caa8c7 97fe5517 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in ip_mroute_setsockopt
2024/11/11 15:27 upstream 2d5404caa8c7 0c4b1325 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/11/11 11:47 upstream 2d5404caa8c7 97fe5517 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce possible deadlock in ip_mroute_setsockopt
2024/11/11 11:47 upstream 2d5404caa8c7 97fe5517 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce possible deadlock in ip_mroute_setsockopt
2024/11/11 05:45 upstream a9cda7c0ffed 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/11/10 07:40 upstream de2f378f2b77 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/11/09 15:56 upstream da4373fbcf00 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in ip_mroute_setsockopt
2024/10/29 10:58 upstream e42b1a9a2557 66aeb999 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root 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/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/11/19 22:32 upstream 158f238aa69d 571351cb .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-386 possible deadlock in ip_mroute_setsockopt
2024/11/15 19:54 upstream cfaaa7d010d1 f6ede3a3 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-386 possible deadlock in ip_mroute_setsockopt
2024/11/13 20:41 upstream f1b785f4c787 a8c99394 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-386 possible deadlock in ip_mroute_setsockopt
2024/11/11 14:02 upstream 2d5404caa8c7 97fe5517 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-386 possible deadlock in ip_mroute_setsockopt
2024/11/06 08:01 upstream 2e1b3cc9d7f7 3a465482 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in ip_mroute_setsockopt
2024/10/14 01:54 upstream 36c254515dc6 084d8178 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in ip_mroute_setsockopt
2024/11/20 18:23 net 66418447d27b 4fca1650 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in ip_mroute_setsockopt
2024/11/19 12:14 net 4262bacb748f 571351cb .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in ip_mroute_setsockopt
2024/11/17 17:42 net 8ffade77b633 cfe3a04a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in ip_mroute_setsockopt
2024/11/12 15:20 net 073d89808c06 75bb1b32 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in ip_mroute_setsockopt
2024/11/12 07:05 net 073d89808c06 75bb1b32 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in ip_mroute_setsockopt
2024/11/12 03:00 net 073d89808c06 97fe5517 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in ip_mroute_setsockopt
2024/11/11 22:46 net 252e01e68241 97fe5517 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in ip_mroute_setsockopt
2024/11/11 07:11 net 252e01e68241 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in ip_mroute_setsockopt
2024/11/11 01:38 net 252e01e68241 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in ip_mroute_setsockopt
2024/11/10 22:46 net 252e01e68241 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in ip_mroute_setsockopt
2024/11/10 21:44 net 252e01e68241 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in ip_mroute_setsockopt
2024/11/10 19:50 net 252e01e68241 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in ip_mroute_setsockopt
2024/11/10 06:15 net eb72e7fcc839 6b856513 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce possible deadlock in ip_mroute_setsockopt
2024/11/20 08:04 net-next dd7207838d38 7d02db5a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in ip_mroute_setsockopt
2024/11/18 18:20 net-next d7ef9eeef072 571351cb .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in ip_mroute_setsockopt
2024/11/16 06:15 net-next dfc14664794a cfe3a04a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in ip_mroute_setsockopt
2024/11/15 16:40 net-next 3d12862b216d f6ede3a3 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in ip_mroute_setsockopt
2024/11/14 01:32 net-next 8545b75bc414 a8c99394 .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.