bisecting fixing commit since d7e78d08fa77acdea351c8f628f49ca9a0e1029a building syzkaller on abf9ba4fc75d9b29af15625d44dcfc1360fad3b7 testing commit d7e78d08fa77acdea351c8f628f49ca9a0e1029a with gcc (GCC) 8.4.1 20210217 kernel signature: 545ca9b7a02637fadfd60cd27981219994f24078ca10309bb66e9e6362e19075 all runs: crashed: possible deadlock in rtnl_lock testing current HEAD cf256fbcbe347b7d0ff58fe2dfa382a156bd3694 testing commit cf256fbcbe347b7d0ff58fe2dfa382a156bd3694 with gcc (GCC) 8.4.1 20210217 kernel signature: 771e557d9c8506a95bfdef427994f0cd866e0589a46ca200e5682fcf1f4d1658 all runs: crashed: possible deadlock in rtnl_lock revisions tested: 2, total time: 22m27.928390181s (build: 15m25.677698535s, test: 6m33.971683557s) the crash still happens on HEAD commit msg: Linux 4.14.231 crash: possible deadlock in rtnl_lock device veth0_macvtap entered promiscuous mode IPVS: ftp: loaded support on port[0] = 21 IPv6: ADDRCONF(NETDEV_UP): macvtap0: link is not ready device veth1_macvtap entered promiscuous mode ====================================================== WARNING: possible circular locking dependency detected IPv6: ADDRCONF(NETDEV_UP): macsec0: link is not ready 4.14.231-syzkaller #0 Not tainted IPv6: ADDRCONF(NETDEV_UP): veth0_to_batadv: link is not ready ------------------------------------------------------ IPv6: ADDRCONF(NETDEV_UP): veth1_to_batadv: link is not ready syz-executor.2/7152 is trying to acquire lock: batman_adv: The newly added mac address (aa:aa:aa:aa:aa:3d) already exists on: batadv_slave_0 (rtnl_mutex){+.+.}, at: [] rtnl_lock+0x12/0x20 net/core/rtnetlink.c:72 but task is already holding lock: (&xt[i].mutex){+.+.}, at: [] xt_find_table_lock+0x37/0x370 net/netfilter/x_tables.c:1088 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&xt[i].mutex){+.+.}: lock_acquire+0x17e/0x3e0 kernel/locking/lockdep.c:3998 __mutex_lock_common kernel/locking/mutex.c:756 [inline] __mutex_lock+0xed/0x1490 kernel/locking/mutex.c:893 mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:908 batman_adv: It is strongly recommended to keep mac addresses unique to avoid problems! match_revfn+0x3d/0x1c0 net/netfilter/x_tables.c:332 xt_find_revision+0x71/0x150 net/netfilter/x_tables.c:380 nfnl_compat_get+0x207/0x8d0 net/netfilter/nft_compat.c:678 nfnetlink_rcv_msg+0x872/0xa60 net/netfilter/nfnetlink.c:214 netlink_rcv_skb+0x12f/0x3b0 net/netlink/af_netlink.c:2433 nfnetlink_rcv+0x176/0x15b0 net/netfilter/nfnetlink.c:515 netlink_unicast_kernel net/netlink/af_netlink.c:1287 [inline] netlink_unicast+0x40b/0x610 net/netlink/af_netlink.c:1313 netlink_sendmsg+0x639/0xbe0 net/netlink/af_netlink.c:1878 sock_sendmsg_nosec net/socket.c:646 [inline] sock_sendmsg+0xac/0xf0 net/socket.c:656 ___sys_sendmsg+0x625/0x920 net/socket.c:2062 __sys_sendmsg+0xc1/0x140 net/socket.c:2096 SYSC_sendmsg net/socket.c:2107 [inline] SyS_sendmsg+0xd/0x20 net/socket.c:2103 batman_adv: The newly added mac address (aa:aa:aa:aa:aa:3d) already exists on: batadv_slave_0 do_syscall_64+0x1c7/0x5b0 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x46/0xbb -> #1 (&table[i].mutex){+.+.}: lock_acquire+0x17e/0x3e0 kernel/locking/lockdep.c:3998 __mutex_lock_common kernel/locking/mutex.c:756 [inline] __mutex_lock+0xed/0x1490 kernel/locking/mutex.c:893 mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:908 nfnl_lock+0x1d/0x20 net/netfilter/nfnetlink.c:61 nf_tables_netdev_event+0x123/0x560 net/netfilter/nf_tables_netdev.c:122 notifier_call_chain+0xd6/0x150 kernel/notifier.c:93 batman_adv: It is strongly recommended to keep mac addresses unique to avoid problems! __raw_notifier_call_chain kernel/notifier.c:394 [inline] raw_notifier_call_chain+0x11/0x20 kernel/notifier.c:401 call_netdevice_notifiers_info+0x4b/0x60 net/core/dev.c:1667 call_netdevice_notifiers net/core/dev.c:1683 [inline] rollback_registered_many+0x652/0xb20 net/core/dev.c:7203 unregister_netdevice_many+0x3e/0x1f0 net/core/dev.c:8285 ip6gre_exit_net+0x394/0x570 net/ipv6/ip6_gre.c:1212 ops_exit_list.isra.3+0x8b/0x120 net/core/net_namespace.c:142 cleanup_net+0x39d/0x7f0 net/core/net_namespace.c:484 process_one_work+0x74f/0x1620 kernel/workqueue.c:2116 worker_thread+0xcc/0xee0 kernel/workqueue.c:2250 kthread+0x338/0x400 kernel/kthread.c:232 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404 batman_adv: The newly added mac address (aa:aa:aa:aa:aa:3d) already exists on: batadv_slave_0 -> #0 batman_adv: It is strongly recommended to keep mac addresses unique to avoid problems! (rtnl_mutex){+.+.}: check_prev_add kernel/locking/lockdep.c:1905 [inline] check_prevs_add kernel/locking/lockdep.c:2022 [inline] validate_chain kernel/locking/lockdep.c:2464 [inline] __lock_acquire+0x32ee/0x42d0 kernel/locking/lockdep.c:3491 lock_acquire+0x17e/0x3e0 kernel/locking/lockdep.c:3998 __mutex_lock_common kernel/locking/mutex.c:756 [inline] __mutex_lock+0xed/0x1490 kernel/locking/mutex.c:893 mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:908 rtnl_lock+0x12/0x20 net/core/rtnetlink.c:72 unregister_netdevice_notifier+0x6a/0x2d0 net/core/dev.c:1630 tee_tg_destroy+0x52/0xa0 net/netfilter/xt_TEE.c:123 cleanup_entry+0x159/0x210 net/ipv4/netfilter/ip_tables.c:666 __do_replace+0x38b/0x5d0 net/ipv6/netfilter/ip6_tables.c:1105 batman_adv: The newly added mac address (aa:aa:aa:aa:aa:3d) already exists on: batadv_slave_0 do_replace net/ipv4/netfilter/ip_tables.c:1142 [inline] do_ipt_set_ctl+0x25c/0x3c0 net/ipv4/netfilter/ip_tables.c:1676 batman_adv: It is strongly recommended to keep mac addresses unique to avoid problems! nf_sockopt net/netfilter/nf_sockopt.c:106 [inline] nf_setsockopt+0x5c/0xb0 net/netfilter/nf_sockopt.c:115 batman_adv: The newly added mac address (aa:aa:aa:aa:aa:3d) already exists on: batadv_slave_0 ip_setsockopt net/ipv4/ip_sockglue.c:1255 [inline] ip_setsockopt+0x59/0x70 net/ipv4/ip_sockglue.c:1240 batman_adv: It is strongly recommended to keep mac addresses unique to avoid problems! udp_setsockopt+0x16/0x30 net/ipv4/udp.c:2452 IPv6: ADDRCONF(NETDEV_UP): batadv_slave_0: link is not ready sock_common_setsockopt+0x73/0xf0 net/core/sock.c:2994 batman_adv: batadv0: Interface activated: batadv_slave_0 SYSC_setsockopt net/socket.c:1865 [inline] SyS_setsockopt+0x130/0x1f0 net/socket.c:1844 batman_adv: The newly added mac address (aa:aa:aa:aa:aa:3e) already exists on: batadv_slave_1 do_syscall_64+0x1c7/0x5b0 arch/x86/entry/common.c:292 batman_adv: It is strongly recommended to keep mac addresses unique to avoid problems! entry_SYSCALL_64_after_hwframe+0x46/0xbb other info that might help us debug this: Chain exists of: rtnl_mutex --> &table[i].mutex --> &xt[i].mutex Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&xt[i].mutex); lock(&table[i].mutex); lock(&xt[i].mutex); lock(rtnl_mutex); *** DEADLOCK *** 1 lock held by syz-executor.2/7152: #0: (&xt[i].mutex){+.+.}, at: [] xt_find_table_lock+0x37/0x370 net/netfilter/x_tables.c:1088 stack backtrace: batman_adv: The newly added mac address (aa:aa:aa:aa:aa:3e) already exists on: batadv_slave_1 CPU: 0 PID: 7152 Comm: syz-executor.2 Not tainted 4.14.231-syzkaller #0 batman_adv: It is strongly recommended to keep mac addresses unique to avoid problems! 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+0x14b/0x1e7 lib/dump_stack.c:58 print_circular_bug.isra.17.cold.40+0x2e3/0x41e kernel/locking/lockdep.c:1258 check_prev_add kernel/locking/lockdep.c:1905 [inline] check_prevs_add kernel/locking/lockdep.c:2022 [inline] validate_chain kernel/locking/lockdep.c:2464 [inline] __lock_acquire+0x32ee/0x42d0 kernel/locking/lockdep.c:3491 batman_adv: The newly added mac address (aa:aa:aa:aa:aa:3e) already exists on: batadv_slave_1 batman_adv: It is strongly recommended to keep mac addresses unique to avoid problems! lock_acquire+0x17e/0x3e0 kernel/locking/lockdep.c:3998 __mutex_lock_common kernel/locking/mutex.c:756 [inline] __mutex_lock+0xed/0x1490 kernel/locking/mutex.c:893 mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:908 batman_adv: The newly added mac address (aa:aa:aa:aa:aa:3e) already exists on: batadv_slave_1 batman_adv: It is strongly recommended to keep mac addresses unique to avoid problems! rtnl_lock+0x12/0x20 net/core/rtnetlink.c:72 unregister_netdevice_notifier+0x6a/0x2d0 net/core/dev.c:1630 tee_tg_destroy+0x52/0xa0 net/netfilter/xt_TEE.c:123 cleanup_entry+0x159/0x210 net/ipv4/netfilter/ip_tables.c:666 __do_replace+0x38b/0x5d0 net/ipv6/netfilter/ip6_tables.c:1105 do_replace net/ipv4/netfilter/ip_tables.c:1142 [inline] do_ipt_set_ctl+0x25c/0x3c0 net/ipv4/netfilter/ip_tables.c:1676 batman_adv: The newly added mac address (aa:aa:aa:aa:aa:3e) already exists on: batadv_slave_1 nf_sockopt net/netfilter/nf_sockopt.c:106 [inline] nf_setsockopt+0x5c/0xb0 net/netfilter/nf_sockopt.c:115 ip_setsockopt net/ipv4/ip_sockglue.c:1255 [inline] ip_setsockopt+0x59/0x70 net/ipv4/ip_sockglue.c:1240 batman_adv: It is strongly recommended to keep mac addresses unique to avoid problems! udp_setsockopt+0x16/0x30 net/ipv4/udp.c:2452 sock_common_setsockopt+0x73/0xf0 net/core/sock.c:2994 SYSC_setsockopt net/socket.c:1865 [inline] SyS_setsockopt+0x130/0x1f0 net/socket.c:1844 do_syscall_64+0x1c7/0x5b0 arch/x86/entry/common.c:292 IPv6: ADDRCONF(NETDEV_UP): batadv_slave_1: link is not ready batman_adv: batadv0: Interface activated: batadv_slave_1 entry_SYSCALL_64_after_hwframe+0x46/0xbb RIP: 0033:0x465109 RSP: 002b:00007f969a535188 EFLAGS: 00000246 ORIG_RAX: 0000000000000036 RAX: ffffffffffffffda RBX: 000000000055cf00 RCX: 0000000000465109 RDX: 0000000000000040 RSI: 0000000000000000 RDI: 0000000000000003 RBP: 00000000004af711 R08: 0000000000000408 R09: 0000000000000000 R10: 0000000020000700 R11: 0000000000000246 R12: 000000000055cf00 R13: 00007ffd0793a14f R14: 00007f969a535300 R15: 0000000000022000 IPv6: ADDRCONF(NETDEV_CHANGE): macvtap0: link becomes ready IPv6: ADDRCONF(NETDEV_CHANGE): macsec0: link becomes ready IPv6: ADDRCONF(NETDEV_CHANGE): batadv_slave_0: link becomes ready IPv6: ADDRCONF(NETDEV_CHANGE): veth0_to_batadv: link becomes ready IPv6: ADDRCONF(NETDEV_CHANGE): batadv_slave_1: link becomes ready IPv6: ADDRCONF(NETDEV_CHANGE): veth1_to_batadv: link becomes ready ip_tables: iptables: counters copy to user failed while replacing table ip_tables: iptables: counters copy to user failed while replacing table ip_tables: iptables: counters copy to user failed while replacing table ip_tables: iptables: counters copy to user failed while replacing table ip_tables: iptables: counters copy to user failed while replacing table IPVS: ftp: loaded support on port[0] = 21 ip_tables: iptables: counters copy to user failed while replacing table ip_tables: iptables: counters copy to user failed while replacing table ip_tables: iptables: counters copy to user failed while replacing table IPVS: ftp: loaded support on port[0] = 21 IPVS: ftp: loaded support on port[0] = 21 net_ratelimit: 31 callbacks suppressed ip_tables: iptables: counters copy to user failed while replacing table ip_tables: iptables: counters copy to user failed while replacing table ip_tables: iptables: counters copy to user failed while replacing table ip_tables: iptables: counters copy to user failed while replacing table ip_tables: iptables: counters copy to user failed while replacing table ip_tables: iptables: counters copy to user failed while replacing table ip_tables: iptables: counters copy to user failed while replacing table ip_tables: iptables: counters copy to user failed while replacing table ip_tables: iptables: counters copy to user failed while replacing table ip_tables: iptables: counters copy to user failed while replacing table IPVS: ftp: loaded support on port[0] = 21 IPVS: ftp: loaded support on port[0] = 21 IPVS: ftp: loaded support on port[0] = 21 IPVS: ftp: loaded support on port[0] = 21 net_ratelimit: 57 callbacks suppressed ip_tables: iptables: counters copy to user failed while replacing table ip_tables: iptables: counters copy to user failed while replacing table ip_tables: iptables: counters copy to user failed while replacing table