netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* possible deadlock in dev_mc_unsync
@ 2020-06-26 17:09 syzbot
  2020-06-27 13:19 ` syzbot
  2020-08-11 12:07 ` syzbot
  0 siblings, 2 replies; 5+ messages in thread
From: syzbot @ 2020-06-26 17:09 UTC (permalink / raw)
  To: ap420073, davem, kuba, linux-kernel, netdev, syzkaller-bugs,
	xiyou.wangcong

Hello,

syzbot found the following crash on:

HEAD commit:    b835a71e usbnet: smsc95xx: Fix use-after-free after removal
git tree:       net
console output: https://syzkaller.appspot.com/x/log.txt?x=16e25419100000
kernel config:  https://syzkaller.appspot.com/x/.config?x=dcc6334acae363d4
dashboard link: https://syzkaller.appspot.com/bug?extid=08e3d39f3eb8643216be
compiler:       gcc (GCC) 10.1.0-syz 20200507

Unfortunately, I don't have any reproducer for this crash yet.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+08e3d39f3eb8643216be@syzkaller.appspotmail.com

============================================
WARNING: possible recursive locking detected
5.8.0-rc1-syzkaller #0 Not tainted
--------------------------------------------
syz-executor.5/12181 is trying to acquire lock:
ffff888090564280 (&vlan_netdev_addr_lock_key/1){+...}-{2:2}, at: netif_addr_lock_nested include/linux/netdevice.h:4243 [inline]
ffff888090564280 (&vlan_netdev_addr_lock_key/1){+...}-{2:2}, at: dev_mc_unsync net/core/dev_addr_lists.c:915 [inline]
ffff888090564280 (&vlan_netdev_addr_lock_key/1){+...}-{2:2}, at: dev_mc_unsync+0xf4/0x190 net/core/dev_addr_lists.c:909

but task is already holding lock:
ffff88805dd76280 (&vlan_netdev_addr_lock_key/1){+...}-{2:2}, at: spin_lock_bh include/linux/spinlock.h:358 [inline]
ffff88805dd76280 (&vlan_netdev_addr_lock_key/1){+...}-{2:2}, at: netif_addr_lock_bh include/linux/netdevice.h:4248 [inline]
ffff88805dd76280 (&vlan_netdev_addr_lock_key/1){+...}-{2:2}, at: dev_mc_unsync net/core/dev_addr_lists.c:914 [inline]
ffff88805dd76280 (&vlan_netdev_addr_lock_key/1){+...}-{2:2}, at: dev_mc_unsync+0xb0/0x190 net/core/dev_addr_lists.c:909

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

       CPU0
       ----
  lock(&vlan_netdev_addr_lock_key/1);
  lock(&vlan_netdev_addr_lock_key/1);

 *** DEADLOCK ***

 May be due to missing lock nesting notation

6 locks held by syz-executor.5/12181:
 #0: ffffffff8a809730 (cb_lock){++++}-{3:3}, at: genl_rcv+0x15/0x40 net/netlink/genetlink.c:763
 #1: ffffffff8a8097e8 (genl_mutex){+.+.}-{3:3}, at: genl_lock net/netlink/genetlink.c:33 [inline]
 #1: ffffffff8a8097e8 (genl_mutex){+.+.}-{3:3}, at: genl_rcv_msg+0x76a/0x9e0 net/netlink/genetlink.c:751
 #2: ffffffff8a7d1088 (devlink_mutex){+.+.}-{3:3}, at: devlink_nl_pre_doit+0x27/0x6a0 net/core/devlink.c:401
 #3: ffff88809df48370 (&nsim_dev->port_list_lock){+.+.}-{3:3}, at: nsim_dev_port_del_all drivers/net/netdevsim/dev.c:951 [inline]
 #3: ffff88809df48370 (&nsim_dev->port_list_lock){+.+.}-{3:3}, at: nsim_dev_reload_destroy+0x9e/0x1e0 drivers/net/netdevsim/dev.c:1130
 #4: ffffffff8a7afda8 (rtnl_mutex){+.+.}-{3:3}, at: nsim_destroy+0x2b/0x60 drivers/net/netdevsim/netdev.c:329
 #5: ffff88805dd76280 (&vlan_netdev_addr_lock_key/1){+...}-{2:2}, at: spin_lock_bh include/linux/spinlock.h:358 [inline]
 #5: ffff88805dd76280 (&vlan_netdev_addr_lock_key/1){+...}-{2:2}, at: netif_addr_lock_bh include/linux/netdevice.h:4248 [inline]
 #5: ffff88805dd76280 (&vlan_netdev_addr_lock_key/1){+...}-{2:2}, at: dev_mc_unsync net/core/dev_addr_lists.c:914 [inline]
 #5: ffff88805dd76280 (&vlan_netdev_addr_lock_key/1){+...}-{2:2}, at: dev_mc_unsync+0xb0/0x190 net/core/dev_addr_lists.c:909

stack backtrace:
CPU: 1 PID: 12181 Comm: syz-executor.5 Not tainted 5.8.0-rc1-syzkaller #0
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+0x18f/0x20d lib/dump_stack.c:118
 print_deadlock_bug kernel/locking/lockdep.c:2391 [inline]
 check_deadlock kernel/locking/lockdep.c:2432 [inline]
 validate_chain kernel/locking/lockdep.c:3202 [inline]
 __lock_acquire.cold+0x178/0x3f8 kernel/locking/lockdep.c:4380
 lock_acquire+0x1f1/0xad0 kernel/locking/lockdep.c:4959
 _raw_spin_lock_nested+0x30/0x40 kernel/locking/spinlock.c:361
 netif_addr_lock_nested include/linux/netdevice.h:4243 [inline]
 dev_mc_unsync net/core/dev_addr_lists.c:915 [inline]
 dev_mc_unsync+0xf4/0x190 net/core/dev_addr_lists.c:909
 vlan_dev_stop+0x51/0x350 net/8021q/vlan_dev.c:315
 __dev_close_many+0x1b3/0x2e0 net/core/dev.c:1599
 dev_close_many+0x238/0x650 net/core/dev.c:1624
 vlan_device_event+0x8ef/0x2010 net/8021q/vlan.c:450
 notifier_call_chain+0xb5/0x200 kernel/notifier.c:83
 call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:2027
 call_netdevice_notifiers_extack net/core/dev.c:2039 [inline]
 call_netdevice_notifiers net/core/dev.c:2053 [inline]
 dev_close_many+0x30b/0x650 net/core/dev.c:1628
 rollback_registered_many+0x3af/0xf60 net/core/dev.c:8945
 unregister_netdevice_many.part.0+0x1a/0x2f0 net/core/dev.c:10113
 unregister_netdevice_many+0x36/0x50 net/core/dev.c:10112
 vlan_device_event+0x1ab5/0x2010 net/8021q/vlan.c:490
 notifier_call_chain+0xb5/0x200 kernel/notifier.c:83
 call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:2027
 call_netdevice_notifiers_extack net/core/dev.c:2039 [inline]
 call_netdevice_notifiers net/core/dev.c:2053 [inline]
 rollback_registered_many+0x665/0xf60 net/core/dev.c:8968
 rollback_registered net/core/dev.c:9013 [inline]
 unregister_netdevice_queue+0x2dd/0x570 net/core/dev.c:10094
 unregister_netdevice include/linux/netdevice.h:2754 [inline]
 nsim_destroy+0x35/0x60 drivers/net/netdevsim/netdev.c:330
 __nsim_dev_port_del+0x144/0x1e0 drivers/net/netdevsim/dev.c:941
 nsim_dev_port_del_all drivers/net/netdevsim/dev.c:954 [inline]
 nsim_dev_reload_destroy+0xff/0x1e0 drivers/net/netdevsim/dev.c:1130
 nsim_dev_reload_down+0x6e/0xd0 drivers/net/netdevsim/dev.c:711
 devlink_reload+0xc1/0x3a0 net/core/devlink.c:2797
 devlink_nl_cmd_reload+0x386/0x880 net/core/devlink.c:2832
 genl_family_rcv_msg_doit net/netlink/genetlink.c:691 [inline]
 genl_family_rcv_msg net/netlink/genetlink.c:736 [inline]
 genl_rcv_msg+0x61d/0x9e0 net/netlink/genetlink.c:753
 netlink_rcv_skb+0x15a/0x430 net/netlink/af_netlink.c:2469
 genl_rcv+0x24/0x40 net/netlink/genetlink.c:764
 netlink_unicast_kernel net/netlink/af_netlink.c:1303 [inline]
 netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1329
 netlink_sendmsg+0x856/0xd90 net/netlink/af_netlink.c:1918
 sock_sendmsg_nosec net/socket.c:652 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:672
 ____sys_sendmsg+0x6e8/0x810 net/socket.c:2352
 ___sys_sendmsg+0xf3/0x170 net/socket.c:2406
 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2439
 do_syscall_64+0x60/0xe0 arch/x86/entry/common.c:359
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x45ca59
Code: Bad RIP value.
RSP: 002b:00007fbbcff89c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00000000004fdec0 RCX: 000000000045ca59
RDX: 0000000000000000 RSI: 0000000020000800 RDI: 0000000000000006
RBP: 000000000078bf00 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
R13: 000000000000092d R14: 00000000004cbff2 R15: 00007fbbcff8a6d4


---
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@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: possible deadlock in dev_mc_unsync
  2020-06-26 17:09 possible deadlock in dev_mc_unsync syzbot
@ 2020-06-27 13:19 ` syzbot
  2020-06-27 18:07   ` Cong Wang
  2020-08-11 12:07 ` syzbot
  1 sibling, 1 reply; 5+ messages in thread
From: syzbot @ 2020-06-27 13:19 UTC (permalink / raw)
  To: ap420073, davem, kuba, linux-kernel, netdev, syzkaller-bugs,
	xiyou.wangcong

syzbot has found a reproducer for the following crash on:

HEAD commit:    4a21185c Merge git://git.kernel.org/pub/scm/linux/kernel/g..
git tree:       net
console output: https://syzkaller.appspot.com/x/log.txt?x=12e8e9c5100000
kernel config:  https://syzkaller.appspot.com/x/.config?x=bf3aec367b9ab569
dashboard link: https://syzkaller.appspot.com/bug?extid=08e3d39f3eb8643216be
compiler:       gcc (GCC) 10.1.0-syz 20200507
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=11d2b1c5100000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=17aed775100000

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+08e3d39f3eb8643216be@syzkaller.appspotmail.com

============================================
WARNING: possible recursive locking detected
5.8.0-rc2-syzkaller #0 Not tainted
--------------------------------------------
syz-executor094/7550 is trying to acquire lock:
ffff8880a8f1e280 (&vlan_netdev_addr_lock_key/1){+...}-{2:2}, at: netif_addr_lock_nested include/linux/netdevice.h:4243 [inline]
ffff8880a8f1e280 (&vlan_netdev_addr_lock_key/1){+...}-{2:2}, at: dev_mc_unsync net/core/dev_addr_lists.c:915 [inline]
ffff8880a8f1e280 (&vlan_netdev_addr_lock_key/1){+...}-{2:2}, at: dev_mc_unsync+0xf4/0x190 net/core/dev_addr_lists.c:909

but task is already holding lock:
ffff8880876f4280 (&vlan_netdev_addr_lock_key/1){+...}-{2:2}, at: spin_lock_bh include/linux/spinlock.h:358 [inline]
ffff8880876f4280 (&vlan_netdev_addr_lock_key/1){+...}-{2:2}, at: netif_addr_lock_bh include/linux/netdevice.h:4248 [inline]
ffff8880876f4280 (&vlan_netdev_addr_lock_key/1){+...}-{2:2}, at: dev_mc_unsync net/core/dev_addr_lists.c:914 [inline]
ffff8880876f4280 (&vlan_netdev_addr_lock_key/1){+...}-{2:2}, at: dev_mc_unsync+0xb0/0x190 net/core/dev_addr_lists.c:909

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

       CPU0
       ----
  lock(&vlan_netdev_addr_lock_key/1);
  lock(&vlan_netdev_addr_lock_key/1);

 *** DEADLOCK ***

 May be due to missing lock nesting notation

2 locks held by syz-executor094/7550:
 #0: ffffffff8a7b0228 (rtnl_mutex){+.+.}-{3:3}, at: rtnl_lock net/core/rtnetlink.c:72 [inline]
 #0: ffffffff8a7b0228 (rtnl_mutex){+.+.}-{3:3}, at: rtnetlink_rcv_msg+0x3f9/0xad0 net/core/rtnetlink.c:5457
 #1: ffff8880876f4280 (&vlan_netdev_addr_lock_key/1){+...}-{2:2}, at: spin_lock_bh include/linux/spinlock.h:358 [inline]
 #1: ffff8880876f4280 (&vlan_netdev_addr_lock_key/1){+...}-{2:2}, at: netif_addr_lock_bh include/linux/netdevice.h:4248 [inline]
 #1: ffff8880876f4280 (&vlan_netdev_addr_lock_key/1){+...}-{2:2}, at: dev_mc_unsync net/core/dev_addr_lists.c:914 [inline]
 #1: ffff8880876f4280 (&vlan_netdev_addr_lock_key/1){+...}-{2:2}, at: dev_mc_unsync+0xb0/0x190 net/core/dev_addr_lists.c:909

stack backtrace:
CPU: 0 PID: 7550 Comm: syz-executor094 Not tainted 5.8.0-rc2-syzkaller #0
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+0x18f/0x20d lib/dump_stack.c:118
 print_deadlock_bug kernel/locking/lockdep.c:2391 [inline]
 check_deadlock kernel/locking/lockdep.c:2432 [inline]
 validate_chain kernel/locking/lockdep.c:3202 [inline]
 __lock_acquire.cold+0x178/0x3f8 kernel/locking/lockdep.c:4380
 lock_acquire+0x1f1/0xad0 kernel/locking/lockdep.c:4959
 _raw_spin_lock_nested+0x30/0x40 kernel/locking/spinlock.c:361
 netif_addr_lock_nested include/linux/netdevice.h:4243 [inline]
 dev_mc_unsync net/core/dev_addr_lists.c:915 [inline]
 dev_mc_unsync+0xf4/0x190 net/core/dev_addr_lists.c:909
 vlan_dev_stop+0x51/0x350 net/8021q/vlan_dev.c:315
 __dev_close_many+0x1b3/0x2e0 net/core/dev.c:1599
 dev_close_many+0x238/0x650 net/core/dev.c:1624
 vlan_device_event+0x8ef/0x2010 net/8021q/vlan.c:450
 notifier_call_chain+0xb5/0x200 kernel/notifier.c:83
 call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:2027
 call_netdevice_notifiers_extack net/core/dev.c:2039 [inline]
 call_netdevice_notifiers net/core/dev.c:2053 [inline]
 dev_close_many+0x30b/0x650 net/core/dev.c:1628
 rollback_registered_many+0x3af/0xf60 net/core/dev.c:8945
 unregister_netdevice_many.part.0+0x1a/0x2f0 net/core/dev.c:10113
 unregister_netdevice_many+0x36/0x50 net/core/dev.c:10112
 rtnl_delete_link net/core/rtnetlink.c:2953 [inline]
 rtnl_dellink+0x351/0xa70 net/core/rtnetlink.c:3005
 rtnetlink_rcv_msg+0x44e/0xad0 net/core/rtnetlink.c:5460
 netlink_rcv_skb+0x15a/0x430 net/netlink/af_netlink.c:2469
 netlink_unicast_kernel net/netlink/af_netlink.c:1303 [inline]
 netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1329
 netlink_sendmsg+0x856/0xd90 net/netlink/af_netlink.c:1918
 sock_sendmsg_nosec net/socket.c:652 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:672
 ____sys_sendmsg+0x6e8/0x810 net/socket.c:2352
 ___sys_sendmsg+0xf3/0x170 net/socket.c:2406
 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2439
 do_syscall_64+0x60/0xe0 arch/x86/entry/common.c:359
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x4495a9
Code: Bad RIP value.
RSP: 002b:00007f5a08ffddb8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00000000006dec68 RCX: 00000000004495a9
RDX: 0000000000000000 RSI: 0000000020000140 RDI: 0000000000000003
RBP: 00000000006dec60 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000006dec6c
R13: 00007ffef4bb9e0f R14: 00007f5a08ffe9c0 R15: 00000000006dec6c


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: possible deadlock in dev_mc_unsync
  2020-06-27 13:19 ` syzbot
@ 2020-06-27 18:07   ` Cong Wang
  2020-06-28 14:11     ` syzbot
  0 siblings, 1 reply; 5+ messages in thread
From: Cong Wang @ 2020-06-27 18:07 UTC (permalink / raw)
  To: syzbot
  Cc: Taehee Yoo, David Miller, Jakub Kicinski, LKML,
	Linux Kernel Network Developers, syzkaller-bugs

#syz test: https://github.com/congwang/linux.git net

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: possible deadlock in dev_mc_unsync
  2020-06-27 18:07   ` Cong Wang
@ 2020-06-28 14:11     ` syzbot
  0 siblings, 0 replies; 5+ messages in thread
From: syzbot @ 2020-06-28 14:11 UTC (permalink / raw)
  To: ap420073, davem, kuba, linux-kernel, netdev, syzkaller-bugs,
	xiyou.wangcong

Hello,

syzbot has tested the proposed patch and the reproducer did not trigger crash:

Reported-and-tested-by: syzbot+08e3d39f3eb8643216be@syzkaller.appspotmail.com

Tested on:

commit:         152c6a4d genetlink: get rid of family->attrbuf
git tree:       https://github.com/congwang/linux.git net
kernel config:  https://syzkaller.appspot.com/x/.config?x=bf3aec367b9ab569
dashboard link: https://syzkaller.appspot.com/bug?extid=08e3d39f3eb8643216be
compiler:       gcc (GCC) 10.1.0-syz 20200507

Note: testing is done by a robot and is best-effort only.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: possible deadlock in dev_mc_unsync
  2020-06-26 17:09 possible deadlock in dev_mc_unsync syzbot
  2020-06-27 13:19 ` syzbot
@ 2020-08-11 12:07 ` syzbot
  1 sibling, 0 replies; 5+ messages in thread
From: syzbot @ 2020-08-11 12:07 UTC (permalink / raw)
  To: ap420073, davem, edumazet, kuba, linux-kernel, netdev,
	syzkaller-bugs, xiyou.wangcong

syzbot suspects this issue was fixed by commit:

commit be74294ffa24f5fbc0d6643842e3e095447e17a2
Author: Cong Wang <xiyou.wangcong@gmail.com>
Date:   Fri Jun 26 18:24:22 2020 +0000

    net: get rid of lockdep_set_class_and_subclass()

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=110b0fc2900000
start commit:   4a21185c Merge git://git.kernel.org/pub/scm/linux/kernel/g..
git tree:       net
kernel config:  https://syzkaller.appspot.com/x/.config?x=bf3aec367b9ab569
dashboard link: https://syzkaller.appspot.com/bug?extid=08e3d39f3eb8643216be
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=11d2b1c5100000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=17aed775100000

If the result looks correct, please mark the issue as fixed by replying with:

#syz fix: net: get rid of lockdep_set_class_and_subclass()

For information about bisection process see: https://goo.gl/tpsmEJ#bisection

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-08-11 12:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-26 17:09 possible deadlock in dev_mc_unsync syzbot
2020-06-27 13:19 ` syzbot
2020-06-27 18:07   ` Cong Wang
2020-06-28 14:11     ` syzbot
2020-08-11 12:07 ` syzbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).