syzbot


possible deadlock in dev_uc_sync

Status: fixed on 2020/11/16 12:12
Subsystems: net
[Documentation on labels]
Reported-by: syzbot+4a0f7bc34e3997a6c7df@syzkaller.appspotmail.com
Fix commit: 0e8b8d6a2d85 net: core: use list_del_init() instead of list_del() in netdev_run_todo()
First crash: 1619d, last: 1520d
Cause bisection: the issue happens on the oldest tested release (bisect log)
Crash: general protection fault in batadv_iv_ogm_queue_add (log)
Repro: C syz .config
  
Discussions (3)
Title Replies (including bot) Last reply
[PATCH 5.9 000/133] 5.9.7-rc1 review 139 (139) 2020/11/10 03:55
[PATCH net] net: core: use list_del_init() instead of list_del() in netdev_run_todo() 2 (2) 2020/10/18 21:53
possible deadlock in dev_uc_sync 0 (2) 2020/10/12 07:02
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 possible deadlock in dev_uc_sync 1 1589d 1589d 0/1 auto-closed as invalid on 2020/12/02 10:24
linux-4.14 possible deadlock in dev_uc_sync 1 1571d 1571d 0/1 auto-closed as invalid on 2020/12/19 23:00

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
5.9.0-rc8-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor655/7496 is trying to acquire lock:
ffff888092808280 (&dev_addr_list_lock_key/2){+...}-{2:2}, at: netif_addr_lock include/linux/netdevice.h:4281 [inline]
ffff888092808280 (&dev_addr_list_lock_key/2){+...}-{2:2}, at: dev_uc_sync+0xdc/0x190 net/core/dev_addr_lists.c:640

but task is already holding lock:
ffff888087efa280 (&macvlan_netdev_addr_lock_key/1){+...}-{2:2}, at: netif_addr_lock_bh include/linux/netdevice.h:4292 [inline]
ffff888087efa280 (&macvlan_netdev_addr_lock_key/1){+...}-{2:2}, at: dev_set_rx_mode net/core/dev.c:8274 [inline]
ffff888087efa280 (&macvlan_netdev_addr_lock_key/1){+...}-{2:2}, at: __dev_open+0x368/0x4d0 net/core/dev.c:1529

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&macvlan_netdev_addr_lock_key/1){+...}-{2:2}:
       _raw_spin_lock_nested+0x30/0x40 kernel/locking/spinlock.c:361
       netif_addr_lock include/linux/netdevice.h:4281 [inline]
       dev_uc_sync+0xdc/0x190 net/core/dev_addr_lists.c:640
       bond_hw_addr_swap drivers/net/bonding/bond_main.c:740 [inline]
       bond_change_active_slave+0xc3d/0x20d0 drivers/net/bonding/bond_main.c:1007
       bond_select_active_slave+0x28d/0xa40 drivers/net/bonding/bond_main.c:1093
       bond_enslave+0x4441/0x49a0 drivers/net/bonding/bond_main.c:1947
       do_set_master+0x1c8/0x220 net/core/rtnetlink.c:2517
       __rtnl_newlink+0x132a/0x1740 net/core/rtnetlink.c:3469
       rtnl_newlink+0x64/0xa0 net/core/rtnetlink.c:3500
       rtnetlink_rcv_msg+0x44e/0xad0 net/core/rtnetlink.c:5563
       netlink_rcv_skb+0x15a/0x430 net/netlink/af_netlink.c:2470
       netlink_unicast_kernel net/netlink/af_netlink.c:1304 [inline]
       netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1330
       netlink_sendmsg+0x856/0xd90 net/netlink/af_netlink.c:1919
       sock_sendmsg_nosec net/socket.c:651 [inline]
       sock_sendmsg+0xcf/0x120 net/socket.c:671
       ____sys_sendmsg+0x6e8/0x810 net/socket.c:2353
       ___sys_sendmsg+0xf3/0x170 net/socket.c:2407
       __sys_sendmsg+0xe5/0x1b0 net/socket.c:2440
       do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
       entry_SYSCALL_64_after_hwframe+0x44/0xa9

-> #0 (&dev_addr_list_lock_key/2){+...}-{2:2}:
       check_prev_add kernel/locking/lockdep.c:2496 [inline]
       check_prevs_add kernel/locking/lockdep.c:2601 [inline]
       validate_chain kernel/locking/lockdep.c:3218 [inline]
       __lock_acquire+0x2a96/0x5780 kernel/locking/lockdep.c:4441
       lock_acquire+0x1f3/0xaf0 kernel/locking/lockdep.c:5029
       _raw_spin_lock_nested+0x30/0x40 kernel/locking/spinlock.c:361
       netif_addr_lock include/linux/netdevice.h:4281 [inline]
       dev_uc_sync+0xdc/0x190 net/core/dev_addr_lists.c:640
       macvlan_set_mac_lists+0x55/0x110 drivers/net/macvlan.c:802
       __dev_set_rx_mode+0x1e2/0x2e0 net/core/dev.c:8269
       dev_set_rx_mode net/core/dev.c:8275 [inline]
       __dev_open+0x370/0x4d0 net/core/dev.c:1529
       dev_open net/core/dev.c:1557 [inline]
       dev_open+0xe8/0x150 net/core/dev.c:1550
       bond_enslave+0x927/0x49a0 drivers/net/bonding/bond_main.c:1728
       do_set_master+0x1c8/0x220 net/core/rtnetlink.c:2517
       __rtnl_newlink+0x132a/0x1740 net/core/rtnetlink.c:3469
       rtnl_newlink+0x64/0xa0 net/core/rtnetlink.c:3500
       rtnetlink_rcv_msg+0x44e/0xad0 net/core/rtnetlink.c:5563
       netlink_rcv_skb+0x15a/0x430 net/netlink/af_netlink.c:2470
       netlink_unicast_kernel net/netlink/af_netlink.c:1304 [inline]
       netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1330
       netlink_sendmsg+0x856/0xd90 net/netlink/af_netlink.c:1919
       sock_sendmsg_nosec net/socket.c:651 [inline]
       sock_sendmsg+0xcf/0x120 net/socket.c:671
       ____sys_sendmsg+0x6e8/0x810 net/socket.c:2353
       ___sys_sendmsg+0xf3/0x170 net/socket.c:2407
       __sys_sendmsg+0xe5/0x1b0 net/socket.c:2440
       do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
       entry_SYSCALL_64_after_hwframe+0x44/0xa9

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&macvlan_netdev_addr_lock_key/1);
                               lock(&dev_addr_list_lock_key/2);
                               lock(&macvlan_netdev_addr_lock_key/1);
  lock(&dev_addr_list_lock_key/2);

 *** DEADLOCK ***

2 locks held by syz-executor655/7496:
 #0: ffffffff8b150908 (rtnl_mutex){+.+.}-{3:3}, at: rtnl_lock net/core/rtnetlink.c:72 [inline]
 #0: ffffffff8b150908 (rtnl_mutex){+.+.}-{3:3}, at: rtnetlink_rcv_msg+0x3f9/0xad0 net/core/rtnetlink.c:5560
 #1: ffff888087efa280 (&macvlan_netdev_addr_lock_key/1){+...}-{2:2}, at: netif_addr_lock_bh include/linux/netdevice.h:4292 [inline]
 #1: ffff888087efa280 (&macvlan_netdev_addr_lock_key/1){+...}-{2:2}, at: dev_set_rx_mode net/core/dev.c:8274 [inline]
 #1: ffff888087efa280 (&macvlan_netdev_addr_lock_key/1){+...}-{2:2}, at: __dev_open+0x368/0x4d0 net/core/dev.c:1529

stack backtrace:
CPU: 0 PID: 7496 Comm: syz-executor655 Not tainted 5.9.0-rc8-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+0x198/0x1fd lib/dump_stack.c:118
 check_noncircular+0x324/0x3e0 kernel/locking/lockdep.c:1827
 check_prev_add kernel/locking/lockdep.c:2496 [inline]
 check_prevs_add kernel/locking/lockdep.c:2601 [inline]
 validate_chain kernel/locking/lockdep.c:3218 [inline]
 __lock_acquire+0x2a96/0x5780 kernel/locking/lockdep.c:4441
 lock_acquire+0x1f3/0xaf0 kernel/locking/lockdep.c:5029
 _raw_spin_lock_nested+0x30/0x40 kernel/locking/spinlock.c:361
 netif_addr_lock include/linux/netdevice.h:4281 [inline]
 dev_uc_sync+0xdc/0x190 net/core/dev_addr_lists.c:640
 macvlan_set_mac_lists+0x55/0x110 drivers/net/macvlan.c:802
 __dev_set_rx_mode+0x1e2/0x2e0 net/core/dev.c:8269
 dev_set_rx_mode net/core/dev.c:8275 [inline]
 __dev_open+0x370/0x4d0 net/core/dev.c:1529
 dev_open net/core/dev.c:1557 [inline]
 dev_open+0xe8/0x150 net/core/dev.c:1550
 bond_enslave+0x927/0x49a0 drivers/net/bonding/bond_main.c:1728
 do_set_master+0x1c8/0x220 net/core/rtnetlink.c:2517
 __rtnl_newlink+0x132a/0x1740 net/core/rtnetlink.c:3469
 rtnl_newlink+0x64/0xa0 net/core/rtnetlink.c:3500
 rtnetlink_rcv_msg+0x44e/0xad0 net/core/rtnetlink.c:5563
 netlink_rcv_skb+0x15a/0x430 net/netlink/af_netlink.c:2470
 netlink_unicast_kernel net/netlink/af_netlink.c:1304 [inline]
 netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1330
 netlink_sendmsg+0x856/0xd90 net/netlink/af_netlink.c:1919
 sock_sendmsg_nosec net/socket.c:651 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:671
 ____sys_sendmsg+0x6e8/0x810 net/socket.c:2353
 ___sys_sendmsg+0xf3/0x170 net/socket.c:2407
 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2440
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x449b39
Code: e8 cc 0c 03 00 48 83 c4 18 c3 0f 1f 80 00 00 00 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 0b 06 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fb38e3d4d98 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00000000006dfca8 RCX: 0000000000449b39
RDX: 0000000000000000 RSI: 0000000020000340 RDI: 0000000000000008
RBP: 00000000006dfca0 R08: 00007fb38e3d5700 R09: 0000000000000000
R10: 00007fb38e3d5700 R11: 0000000000000246 R12: 00000000006dfcac
R13: 00000000000003ff R14: 0000003f797fa400 R15: 070d00100000003c
bond9: (slave macvlan9): Enslaving as an active interface with a down link

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/10/12 07:02 upstream 3dd0130f2430 4a77ae0b .config console log report syz C ci-upstream-kasan-gce
2020/10/12 03:51 upstream 3dd0130f2430 4a77ae0b .config console log report info ci-upstream-kasan-gce
2020/07/05 11:17 net-next-old e44f65fd666c 51095195 .config console log report ci-upstream-net-kasan-gce
* Struck through repros no longer work on HEAD.