possible deadlock in smc_close_non_accepted

22 views
Skip to first unread message

syzbot

unread,
Mar 2, 2018, 3:59:02 AM3/2/18
to da...@davemloft.net, linux-...@vger.kernel.org, linux...@vger.kernel.org, net...@vger.kernel.org, syzkall...@googlegroups.com, ubr...@linux.vnet.ibm.com
Hello,

syzbot hit the following crash on net-next commit
f1c02cfb7b30f5c9d9f4e383260abf89d89c3341 (Wed Feb 28 15:40:08 2018 +0000)
ipv6: allow userspace to add IFA_F_OPTIMISTIC addresses

So far this crash happened 3 times on net-next, upstream.
C reproducer is attached.
syzkaller reproducer is attached.
Raw console output is attached.
compiler: gcc (GCC) 7.1.1 20170620
.config is attached.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+e51e2a...@syzkaller.appspotmail.com
It will help syzbot understand when the bug is fixed. See footer for
details.
If you forward the report, please keep this part and the footer.

IPv6: ADDRCONF(NETDEV_UP): veth0: link is not ready
IPv6: ADDRCONF(NETDEV_CHANGE): veth0: link becomes ready
TCP: request_sock_TCP: Possible SYN flooding on port 20003. Sending
cookies. Check SNMP counters.

============================================
WARNING: possible recursive locking detected
4.16.0-rc2+ #247 Not tainted
--------------------------------------------
syzkaller232072/4280 is trying to acquire lock:
(sk_lock-AF_SMC){+.+.}, at: [<000000003c81ac0a>] lock_sock
include/net/sock.h:1464 [inline]
(sk_lock-AF_SMC){+.+.}, at: [<000000003c81ac0a>]
smc_close_non_accepted+0x1d/0x370 net/smc/af_smc.c:664

but task is already holding lock:
(sk_lock-AF_SMC){+.+.}, at: [<00000000952086ed>] lock_sock
include/net/sock.h:1464 [inline]
(sk_lock-AF_SMC){+.+.}, at: [<00000000952086ed>]
smc_close_wait_listen_clcsock net/smc/smc_close.c:47 [inline]
(sk_lock-AF_SMC){+.+.}, at: [<00000000952086ed>]
smc_close_active+0x8d9/0x11f0 net/smc/smc_close.c:207

other info that might help us debug this:
Possible unsafe locking scenario:

CPU0
----
lock(sk_lock-AF_SMC);
lock(sk_lock-AF_SMC);

*** DEADLOCK ***

May be due to missing lock nesting notation

1 lock held by syzkaller232072/4280:
#0: (sk_lock-AF_SMC){+.+.}, at: [<00000000952086ed>] lock_sock
include/net/sock.h:1464 [inline]
#0: (sk_lock-AF_SMC){+.+.}, at: [<00000000952086ed>]
smc_close_wait_listen_clcsock net/smc/smc_close.c:47 [inline]
#0: (sk_lock-AF_SMC){+.+.}, at: [<00000000952086ed>]
smc_close_active+0x8d9/0x11f0 net/smc/smc_close.c:207

stack backtrace:
CPU: 0 PID: 4280 Comm: syzkaller232072 Not tainted 4.16.0-rc2+ #247
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x194/0x24d lib/dump_stack.c:53
print_deadlock_bug kernel/locking/lockdep.c:1761 [inline]
check_deadlock kernel/locking/lockdep.c:1805 [inline]
validate_chain kernel/locking/lockdep.c:2401 [inline]
__lock_acquire+0xe8f/0x3e00 kernel/locking/lockdep.c:3431
lock_acquire+0x1d5/0x580 kernel/locking/lockdep.c:3920
lock_sock_nested+0xc2/0x110 net/core/sock.c:2781
lock_sock include/net/sock.h:1464 [inline]
smc_close_non_accepted+0x1d/0x370 net/smc/af_smc.c:664
smc_close_cleanup_listen net/smc/smc_close.c:30 [inline]
smc_close_active+0x9aa/0x11f0 net/smc/smc_close.c:209
smc_release+0x379/0x580 net/smc/af_smc.c:125
sock_release+0x8d/0x1e0 net/socket.c:594
sock_close+0x16/0x20 net/socket.c:1149
__fput+0x327/0x7e0 fs/file_table.c:209
____fput+0x15/0x20 fs/file_table.c:243
task_work_run+0x199/0x270 kernel/task_work.c:113
exit_task_work include/linux/task_work.h:22 [inline]
do_exit+0x9bb/0x1ad0 kernel/exit.c:865
do_group_exit+0x149/0x400 kernel/exit.c:968
get_signal+0x73a/0x16d0 kernel/signal.c:2469
do_signal+0x90/0x1e90 arch/x86/kernel/signal.c:809
exit_to_usermode_loop+0x258/0x2f0 arch/x86/entry/common.c:162
prepare_exit_to_usermode arch/x86/entry/common.c:196 [inline]
syscall_return_slowpath arch/x86/entry/common.c:265 [inline]
do_syscall_64+0x6e5/0x940 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x446bc9
RSP: 002b:00007fb04b3eed58 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca
RAX: fffffffffffffe00 RBX: 00000000006dcc24 RCX: 0000000000446bc9
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00000000006dcc24
RBP: 0000000000000000 R08: 0000000020000080 R09: 0000000020000080
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000006dcc20
R13: 00007ffd2d6a6f2f R14: 00007fb04b3ef9c0 R15: 0000000000000005


---
This bug is generated by a dumb bot. It may contain errors.
See https://goo.gl/tpsmEJ for details.
Direct all questions to syzk...@googlegroups.com.

syzbot will keep track of this bug report.
If you forgot to add the Reported-by tag, once the fix for this bug is
merged
into any tree, please reply to this email with:
#syz fix: exact-commit-title
If you want to test a patch for this bug, please reply with:
#syz test: git://repo/address.git branch
and provide the patch inline or as an attachment.
To mark this as a duplicate of another syzbot report, please reply with:
#syz dup: exact-subject-of-another-report
If it's a one-off invalid bug report, please reply with:
#syz invalid
Note: if the crash happens again, it will cause creation of a new bug
report.
Note: all commands must start from beginning of the line in the email body.
raw.log.txt
repro.syz.txt
repro.c.txt
config.txt

Hangbin Liu

unread,
May 3, 2018, 11:45:18 PM5/3/18
to syzbot, da...@davemloft.net, linux-...@vger.kernel.org, linux...@vger.kernel.org, net...@vger.kernel.org, syzkall...@googlegroups.com, ubr...@linux.vnet.ibm.com
#syz fix: net/smc: simplify wait when closing listen socket
Reply all
Reply to author
Forward
0 new messages