possible deadlock in neigh_change_state
From: syzbot
Date: Wed Dec 12 2018 - 06:11:24 EST
Hello,
syzbot found the following crash on:
HEAD commit: addb0679839a Merge git://git.kernel.org/pub/scm/linux/kern..
git tree: net-next
console output: https://syzkaller.appspot.com/x/log.txt?x=13320143400000
kernel config: https://syzkaller.appspot.com/x/.config?x=d9655b05acfc97ff
dashboard link: https://syzkaller.appspot.com/bug?extid=6a3c02010a025ac7b7cf
compiler: gcc (GCC) 8.0.1 20180413 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=13317705400000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=177bb01b400000
IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+6a3c02010a025ac7b7cf@xxxxxxxxxxxxxxxxxxxxxxxxx
IPv6: ADDRCONF(NETDEV_CHANGE): veth1: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): veth0: link becomes ready
8021q: adding VLAN 0 to HW filter on device team0
======================================================
WARNING: possible circular locking dependency detected
4.20.0-rc6+ #338 Not tainted
------------------------------------------------------
syz-executor662/6051 is trying to acquire lock:
000000000d190a6e (&tbl->lock){+.-.}, at: neigh_change_state+0x1dc/0x7a0
net/core/neighbour.c:141
but task is already holding lock:
000000006a610774 (&n->lock){++--}, at: __neigh_update+0xe6/0x1eb0
net/core/neighbour.c:1203
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #1 (&n->lock){++--}:
__raw_write_lock include/linux/rwlock_api_smp.h:210 [inline]
_raw_write_lock+0x2d/0x40 kernel/locking/spinlock.c:288
neigh_flush_dev+0x34f/0x960 net/core/neighbour.c:294
neigh_changeaddr+0x31/0x40 net/core/neighbour.c:325
ndisc_netdev_event+0xe6/0x5b0 net/ipv6/ndisc.c:1770
notifier_call_chain+0x17e/0x380 kernel/notifier.c:93
__raw_notifier_call_chain kernel/notifier.c:394 [inline]
raw_notifier_call_chain+0x2d/0x40 kernel/notifier.c:401
call_netdevice_notifiers_info+0x3f/0x90 net/core/dev.c:1737
call_netdevice_notifiers_extack net/core/dev.c:1749 [inline]
call_netdevice_notifiers net/core/dev.c:1763 [inline]
dev_set_mac_address+0x293/0x3b0 net/core/dev.c:7780
do_setlink+0x7c7/0x3f30 net/core/rtnetlink.c:2447
__rtnl_newlink+0xcde/0x19e0 net/core/rtnetlink.c:3115
rtnl_newlink+0x6b/0xa0 net/core/rtnetlink.c:3240
rtnetlink_rcv_msg+0x46a/0xc20 net/core/rtnetlink.c:4969
netlink_rcv_skb+0x172/0x440 net/netlink/af_netlink.c:2477
rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:4987
netlink_unicast_kernel net/netlink/af_netlink.c:1310 [inline]
netlink_unicast+0x5a5/0x760 net/netlink/af_netlink.c:1336
netlink_sendmsg+0xa18/0xfc0 net/netlink/af_netlink.c:1917
sock_sendmsg_nosec net/socket.c:621 [inline]
sock_sendmsg+0xd5/0x120 net/socket.c:631
___sys_sendmsg+0x7fd/0x930 net/socket.c:2116
__sys_sendmsg+0x11d/0x280 net/socket.c:2154
__do_sys_sendmsg net/socket.c:2163 [inline]
__se_sys_sendmsg net/socket.c:2161 [inline]
__x64_sys_sendmsg+0x78/0xb0 net/socket.c:2161
do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
-> #0 (&tbl->lock){+.-.}:
lock_acquire+0x1ed/0x520 kernel/locking/lockdep.c:3844
__raw_write_lock_bh include/linux/rwlock_api_smp.h:203 [inline]
_raw_write_lock_bh+0x31/0x40 kernel/locking/spinlock.c:312
neigh_change_state+0x1dc/0x7a0 net/core/neighbour.c:141
__neigh_update+0x478/0x1eb0 net/core/neighbour.c:1302
neigh_update+0x37/0x50 net/core/neighbour.c:1372
arp_req_set+0x54c/0xaa0 net/ipv4/arp.c:1072
arp_ioctl+0x48b/0xae0 net/ipv4/arp.c:1230
inet_ioctl+0x237/0x360 net/ipv4/af_inet.c:932
sock_do_ioctl+0xeb/0x420 net/socket.c:950
sock_ioctl+0x313/0x690 net/socket.c:1074
vfs_ioctl fs/ioctl.c:46 [inline]
file_ioctl fs/ioctl.c:509 [inline]
do_vfs_ioctl+0x1de/0x1790 fs/ioctl.c:696
ksys_ioctl+0xa9/0xd0 fs/ioctl.c:713
__do_sys_ioctl fs/ioctl.c:720 [inline]
__se_sys_ioctl fs/ioctl.c:718 [inline]
__x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:718
do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&n->lock);
lock(&tbl->lock);
lock(&n->lock);
lock(&tbl->lock);
*** DEADLOCK ***
2 locks held by syz-executor662/6051:
#0: 000000003d2094e6 (rtnl_mutex){+.+.}, at: rtnl_lock+0x17/0x20
net/core/rtnetlink.c:77
#1: 000000006a610774 (&n->lock){++--}, at: __neigh_update+0xe6/0x1eb0
net/core/neighbour.c:1203
stack backtrace:
CPU: 0 PID: 6051 Comm: syz-executor662 Not tainted 4.20.0-rc6+ #338
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x244/0x39d lib/dump_stack.c:113
print_circular_bug.isra.35.cold.54+0x1bd/0x27d
kernel/locking/lockdep.c:1221
check_prev_add kernel/locking/lockdep.c:1863 [inline]
check_prevs_add kernel/locking/lockdep.c:1976 [inline]
validate_chain kernel/locking/lockdep.c:2347 [inline]
__lock_acquire+0x3399/0x4c20 kernel/locking/lockdep.c:3341
lock_acquire+0x1ed/0x520 kernel/locking/lockdep.c:3844
__raw_write_lock_bh include/linux/rwlock_api_smp.h:203 [inline]
_raw_write_lock_bh+0x31/0x40 kernel/locking/spinlock.c:312
neigh_change_state+0x1dc/0x7a0 net/core/neighbour.c:141
__neigh_update+0x478/0x1eb0 net/core/neighbour.c:1302
neigh_update+0x37/0x50 net/core/neighbour.c:1372
arp_req_set+0x54c/0xaa0 net/ipv4/arp.c:1072
arp_ioctl+0x48b/0xae0 net/ipv4/arp.c:1230
inet_ioctl+0x237/0x360 net/ipv4/af_inet.c:932
sock_do_ioctl+0xeb/0x420 net/socket.c:950
sock_ioctl+0x313/0x690 net/socket.c:1074
vfs_ioctl fs/ioctl.c:46 [inline]
file_ioctl fs/ioctl.c:509 [inline]
do_vfs_ioctl+0x1de/0x1790 fs/ioctl.c:696
ksys_ioctl+0xa9/0xd0 fs/ioctl.c:713
__do_sys_ioctl fs/ioctl.c:720 [inline]
__se_sys_ioctl fs/ioctl.c:718 [inline]
__x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:718
do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x441089
Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 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 0f 83 db 0a fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffc4143a2e8 EFLAGS: 00000213 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 0000000000441089
RDX: 0000000020000000 RSI: 0000000000008955 RDI: 0000000000000003
RBP: 00000000006cc018 R08: 0000000000000100 R09: 0000000000000100
R10: 0000000000000020 R11: 0000000000000213 R12: 0000000000401ff0
R13: 0000000000402080 R14: 0000000000000000 R15: 0000000000000000
---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@xxxxxxxxxxxxxxxxx
syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#bug-status-tracking for how to communicate with
syzbot.
syzbot can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches