syzbot


possible deadlock in smc_close_non_accepted (2)

Status: upstream: reported on 2025/01/19 05:50
Subsystems: s390 net
[Documentation on labels]
Reported-by: syzbot+a68f8bafb37fc879d662@syzkaller.appspotmail.com
First crash: 5d17h, last: 5d17h
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [s390?] [net?] possible deadlock in smc_close_non_accepted (2) 0 (1) 2025/01/19 05:50
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in smc_close_non_accepted net s390 C 4 2516d 2516d 5/28 fixed on 2018/05/05 09:58

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.13.0-rc7-syzkaller-00039-gc3812b15000c #0 Not tainted
------------------------------------------------------
syz.1.909/9790 is trying to acquire lock:
ffff8880325e8dd8 (sk_lock-AF_SMC){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1623 [inline]
ffff8880325e8dd8 (sk_lock-AF_SMC){+.+.}-{0:0}, at: smc_close_non_accepted+0x80/0x200 net/smc/af_smc.c:1832

but task is already holding lock:
ffff88807a380dd8 (sk_lock-AF_INET/1){+.+.}-{0:0}, at: smc_release+0x378/0x5f0 net/smc/af_smc.c:336

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #4 (sk_lock-AF_INET/1){+.+.}-{0:0}:
       lock_sock_nested+0x3a/0xf0 net/core/sock.c:3625
       sctp_sock_migrate+0x987/0x1270 net/sctp/socket.c:9655
       sctp_accept+0x654/0x800 net/sctp/socket.c:4899
       inet_accept+0xc4/0x180 net/ipv4/af_inet.c:781
       do_accept+0x337/0x530 net/socket.c:1941
       __sys_accept4_file net/socket.c:1981 [inline]
       __sys_accept4+0xfe/0x1b0 net/socket.c:2010
       __do_sys_accept net/socket.c:2023 [inline]
       __se_sys_accept net/socket.c:2020 [inline]
       __x64_sys_accept+0x74/0xb0 net/socket.c:2020
       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

-> #3 (sk_lock-AF_INET){+.+.}-{0:0}:
       lock_sock_nested+0x3a/0xf0 net/core/sock.c:3625
       lock_sock include/net/sock.h:1623 [inline]
       sockopt_lock_sock net/core/sock.c:1126 [inline]
       sockopt_lock_sock+0x54/0x70 net/core/sock.c:1117
       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:2313
       __sys_setsockopt+0x1a0/0x230 net/socket.c:2338
       __do_sys_setsockopt net/socket.c:2344 [inline]
       __se_sys_setsockopt net/socket.c:2341 [inline]
       __x64_sys_setsockopt+0xbd/0x160 net/socket.c:2341
       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

-> #2 (rtnl_mutex){+.+.}-{4:4}:
       __mutex_lock_common kernel/locking/mutex.c:585 [inline]
       __mutex_lock+0x19b/0xa60 kernel/locking/mutex.c:735
       do_ip_setsockopt+0xf9/0x38c0 net/ipv4/ip_sockglue.c:1077
       ip_setsockopt+0x59/0xf0 net/ipv4/ip_sockglue.c:1417
       ipv6_setsockopt+0x155/0x170 net/ipv6/ipv6_sockglue.c:988
       tcp_setsockopt+0xa4/0x100 net/ipv4/tcp.c:4030
       smc_setsockopt+0x1b4/0xc00 net/smc/af_smc.c:3078
       do_sock_setsockopt+0x222/0x480 net/socket.c:2313
       __sys_setsockopt+0x1a0/0x230 net/socket.c:2338
       __do_sys_setsockopt net/socket.c:2344 [inline]
       __se_sys_setsockopt net/socket.c:2341 [inline]
       __x64_sys_setsockopt+0xbd/0x160 net/socket.c:2341
       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 (&smc->clcsock_release_lock){+.+.}-{4:4}:
       __mutex_lock_common kernel/locking/mutex.c:585 [inline]
       __mutex_lock+0x19b/0xa60 kernel/locking/mutex.c:735
       smc_switch_to_fallback+0x2d/0xa00 net/smc/af_smc.c:903
       smc_sendmsg+0x13d/0x520 net/smc/af_smc.c:2778
       sock_sendmsg_nosec net/socket.c:711 [inline]
       __sock_sendmsg net/socket.c:726 [inline]
       ____sys_sendmsg+0x9ae/0xb40 net/socket.c:2583
       ___sys_sendmsg+0x135/0x1e0 net/socket.c:2637
       __sys_sendmmsg+0x201/0x420 net/socket.c:2726
       __do_sys_sendmmsg net/socket.c:2753 [inline]
       __se_sys_sendmmsg net/socket.c:2750 [inline]
       __x64_sys_sendmmsg+0x9c/0x100 net/socket.c:2750
       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 (sk_lock-AF_SMC){+.+.}-{0:0}:
       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+0x249e/0x3c40 kernel/locking/lockdep.c:5226
       lock_acquire.part.0+0x11b/0x380 kernel/locking/lockdep.c:5849
       lock_sock_nested+0x3a/0xf0 net/core/sock.c:3625
       lock_sock include/net/sock.h:1623 [inline]
       smc_close_non_accepted+0x80/0x200 net/smc/af_smc.c:1832
       smc_close_cleanup_listen net/smc/smc_close.c:45 [inline]
       smc_close_active+0xc3c/0x1070 net/smc/smc_close.c:225
       __smc_release+0x634/0x880 net/smc/af_smc.c:277
       smc_release+0x1fc/0x5f0 net/smc/af_smc.c:344
       __sock_release+0xb0/0x270 net/socket.c:640
       sock_close+0x1c/0x30 net/socket.c:1408
       __fput+0x3f8/0xb60 fs/file_table.c:450
       task_work_run+0x14e/0x250 kernel/task_work.c:239
       resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
       exit_to_user_mode_loop kernel/entry/common.c:114 [inline]
       exit_to_user_mode_prepare include/linux/entry-common.h:329 [inline]
       __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline]
       syscall_exit_to_user_mode+0x27b/0x2a0 kernel/entry/common.c:218
       do_syscall_64+0xda/0x250 arch/x86/entry/common.c:89
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

other info that might help us debug this:

Chain exists of:
  sk_lock-AF_SMC --> sk_lock-AF_INET --> sk_lock-AF_INET/1

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(sk_lock-AF_INET/1);
                               lock(sk_lock-AF_INET);
                               lock(sk_lock-AF_INET/1);
  lock(sk_lock-AF_SMC);

 *** DEADLOCK ***

2 locks held by syz.1.909/9790:
 #0: ffff888049c7f408 (&sb->s_type->i_mutex_key#10){+.+.}-{4:4}, at: inode_lock include/linux/fs.h:818 [inline]
 #0: ffff888049c7f408 (&sb->s_type->i_mutex_key#10){+.+.}-{4:4}, at: __sock_release+0x86/0x270 net/socket.c:639
 #1: ffff88807a380dd8 (sk_lock-AF_INET/1){+.+.}-{0:0}, at: smc_release+0x378/0x5f0 net/smc/af_smc.c:336

stack backtrace:
CPU: 0 UID: 0 PID: 9790 Comm: syz.1.909 Not tainted 6.13.0-rc7-syzkaller-00039-gc3812b15000c #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/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+0x41c/0x610 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+0x249e/0x3c40 kernel/locking/lockdep.c:5226
 lock_acquire.part.0+0x11b/0x380 kernel/locking/lockdep.c:5849
 lock_sock_nested+0x3a/0xf0 net/core/sock.c:3625
 lock_sock include/net/sock.h:1623 [inline]
 smc_close_non_accepted+0x80/0x200 net/smc/af_smc.c:1832
 smc_close_cleanup_listen net/smc/smc_close.c:45 [inline]
 smc_close_active+0xc3c/0x1070 net/smc/smc_close.c:225
 __smc_release+0x634/0x880 net/smc/af_smc.c:277
 smc_release+0x1fc/0x5f0 net/smc/af_smc.c:344
 __sock_release+0xb0/0x270 net/socket.c:640
 sock_close+0x1c/0x30 net/socket.c:1408
 __fput+0x3f8/0xb60 fs/file_table.c:450
 task_work_run+0x14e/0x250 kernel/task_work.c:239
 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
 exit_to_user_mode_loop kernel/entry/common.c:114 [inline]
 exit_to_user_mode_prepare include/linux/entry-common.h:329 [inline]
 __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline]
 syscall_exit_to_user_mode+0x27b/0x2a0 kernel/entry/common.c:218
 do_syscall_64+0xda/0x250 arch/x86/entry/common.c:89
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fe6cff85d29
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:00007fe6d0ce0038 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4
RAX: 0000000000000000 RBX: 00007fe6d0175fa0 RCX: 00007fe6cff85d29
RDX: 0000000000000000 RSI: 000000000000000a RDI: 0000000000000002
RBP: 00007fe6d0001b08 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007fe6d0175fa0 R15: 00007ffd3f25a1e8
 </TASK>

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/01/15 05:39 upstream c3812b15000c 7315a7cf .config console log report info [disk image] [vmlinux] [kernel image] ci-qemu-gce-upstream-auto possible deadlock in smc_close_non_accepted
* Struck through repros no longer work on HEAD.