syzbot


possible deadlock in rtnl_lock

Status: upstream: reported C repro on 2020/01/06 01:45
Reported-by: syzbot+b60aa6f86a4198c1258e@syzkaller.appspotmail.com
First crash: 908d, last: 767d

Fix bisection: the fix commit could be any of (bisect log):
  98db2bf27b9e Linux 4.14.171
  4139fb08c05f Linux 4.14.187
similar bugs (9):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-44 possible deadlock in rtnl_lock C 4676 985d 1177d 0/2 public: reported C repro on 2019/04/12 00:00
upstream possible deadlock in rtnl_lock (5) C 1009 1529d 1558d 6/22 fixed on 2018/05/08 18:30
upstream possible deadlock in rtnl_lock (3) C 3633 1606d 1607d 4/22 fixed on 2018/02/07 13:48
linux-4.19 possible deadlock in rtnl_lock C error 31 658d 908d 0/1 upstream: reported C repro on 2020/01/06 01:18
upstream possible deadlock in rtnl_lock (4) C 73333 1589d 1606d 4/22 fixed on 2018/02/26 20:04
upstream possible deadlock in rtnl_lock (6) C done error 551 848d 1090d 0/22 upstream: reported C repro on 2019/07/08 19:37
android-49 possible deadlock in rtnl_lock C 2906 1407d 1559d 0/3 closed as invalid on 2019/04/05 05:43
upstream possible deadlock in rtnl_lock C 15711 1612d 1669d 4/22 fixed on 2018/02/01 04:00
upstream possible deadlock in rtnl_lock (2) C 10369 1609d 1612d 4/22 fixed on 2018/02/04 23:45

Sample crash report:
audit: type=1400 audit(1582699733.430:38): avc:  denied  { write } for  pid=7245 comm="syz-executor587" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=netlink_netfilter_socket permissive=1
======================================================
WARNING: possible circular locking dependency detected
4.14.171-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor587/7242 is trying to acquire lock:
 (rtnl_mutex){+.+.}, at: [<ffffffff85214c07>] rtnl_lock+0x17/0x20 net/core/rtnetlink.c:72

but task is already holding lock:
 (&xt[i].mutex){+.+.}, at: [<ffffffff854c922c>] xt_find_table_lock+0x3c/0x3d0 net/netfilter/x_tables.c:1092

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&xt[i].mutex){+.+.}:
       lock_acquire+0x16f/0x430 kernel/locking/lockdep.c:3994
       __mutex_lock_common kernel/locking/mutex.c:756 [inline]
       __mutex_lock+0xe8/0x1470 kernel/locking/mutex.c:893
       mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:908
       xt_find_revision+0x82/0x200 net/netfilter/x_tables.c:373
       nfnl_compat_get+0x229/0x950 net/netfilter/nft_compat.c:678
       nfnetlink_rcv_msg+0xa08/0xc00 net/netfilter/nfnetlink.c:214
       netlink_rcv_skb+0x14f/0x3c0 net/netlink/af_netlink.c:2432
       nfnetlink_rcv+0x1ab/0x1650 net/netfilter/nfnetlink.c:515
       netlink_unicast_kernel net/netlink/af_netlink.c:1286 [inline]
       netlink_unicast+0x44d/0x650 net/netlink/af_netlink.c:1312
       netlink_sendmsg+0x7c4/0xc60 net/netlink/af_netlink.c:1877
       sock_sendmsg_nosec net/socket.c:646 [inline]
       sock_sendmsg+0xce/0x110 net/socket.c:656
       ___sys_sendmsg+0x70a/0x840 net/socket.c:2062
       __sys_sendmsg+0xb9/0x140 net/socket.c:2096
       SYSC_sendmsg net/socket.c:2107 [inline]
       SyS_sendmsg+0x2d/0x50 net/socket.c:2103
       do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
       entry_SYSCALL_64_after_hwframe+0x42/0xb7

-> #1 (&table[i].mutex){+.+.}:
       lock_acquire+0x16f/0x430 kernel/locking/lockdep.c:3994
       __mutex_lock_common kernel/locking/mutex.c:756 [inline]
       __mutex_lock+0xe8/0x1470 kernel/locking/mutex.c:893
       mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:908
       nfnl_lock+0x24/0x30 net/netfilter/nfnetlink.c:61
       nf_tables_netdev_event+0x13f/0x580 net/netfilter/nf_tables_netdev.c:122
       notifier_call_chain+0x111/0x1b0 kernel/notifier.c:93
       __raw_notifier_call_chain kernel/notifier.c:394 [inline]
       raw_notifier_call_chain+0x2e/0x40 kernel/notifier.c:401
       call_netdevice_notifiers_info+0x56/0x70 net/core/dev.c:1671
       call_netdevice_notifiers net/core/dev.c:1687 [inline]
       rollback_registered_many+0x70d/0xb60 net/core/dev.c:7205
       rollback_registered+0xdd/0x180 net/core/dev.c:7247
       unregister_netdevice_queue net/core/dev.c:8259 [inline]
       unregister_netdevice_queue+0x1ae/0x230 net/core/dev.c:8252
       unregister_netdevice include/linux/netdevice.h:2442 [inline]
       veth_newlink+0x58e/0x900 drivers/net/veth.c:463
       rtnl_newlink+0xecb/0x1700 net/core/rtnetlink.c:2728
       rtnetlink_rcv_msg+0x3da/0xb70 net/core/rtnetlink.c:4315
       netlink_rcv_skb+0x14f/0x3c0 net/netlink/af_netlink.c:2432
       rtnetlink_rcv+0x1d/0x30 net/core/rtnetlink.c:4327
       netlink_unicast_kernel net/netlink/af_netlink.c:1286 [inline]
       netlink_unicast+0x44d/0x650 net/netlink/af_netlink.c:1312
       netlink_sendmsg+0x7c4/0xc60 net/netlink/af_netlink.c:1877
       sock_sendmsg_nosec net/socket.c:646 [inline]
       sock_sendmsg+0xce/0x110 net/socket.c:656
       ___sys_sendmsg+0x70a/0x840 net/socket.c:2062
       __sys_sendmsg+0xb9/0x140 net/socket.c:2096
       SYSC_sendmsg net/socket.c:2107 [inline]
       SyS_sendmsg+0x2d/0x50 net/socket.c:2103
       do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
       entry_SYSCALL_64_after_hwframe+0x42/0xb7

-> #0 (rtnl_mutex){+.+.}:
       check_prev_add kernel/locking/lockdep.c:1901 [inline]
       check_prevs_add kernel/locking/lockdep.c:2018 [inline]
       validate_chain kernel/locking/lockdep.c:2460 [inline]
       __lock_acquire+0x2cb3/0x4620 kernel/locking/lockdep.c:3487
       lock_acquire+0x16f/0x430 kernel/locking/lockdep.c:3994
       __mutex_lock_common kernel/locking/mutex.c:756 [inline]
       __mutex_lock+0xe8/0x1470 kernel/locking/mutex.c:893
       mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:908
       rtnl_lock+0x17/0x20 net/core/rtnetlink.c:72
       unregister_netdevice_notifier+0x5f/0x2c0 net/core/dev.c:1634
       tee_tg_destroy+0x61/0xc0 net/netfilter/xt_TEE.c:123
       cleanup_entry+0x1a6/0x260 net/ipv6/netfilter/ip6_tables.c:684
       __do_replace+0x3c5/0x5c0 net/ipv6/netfilter/ip6_tables.c:1105
       do_replace net/ipv6/netfilter/ip6_tables.c:1161 [inline]
       do_ip6t_set_ctl+0x296/0x3f4 net/ipv6/netfilter/ip6_tables.c:1685
       nf_sockopt net/netfilter/nf_sockopt.c:106 [inline]
       nf_setsockopt+0x67/0xc0 net/netfilter/nf_sockopt.c:115
       ipv6_setsockopt net/ipv6/ipv6_sockglue.c:930 [inline]
       ipv6_setsockopt+0x105/0x130 net/ipv6/ipv6_sockglue.c:914
       tcp_setsockopt net/ipv4/tcp.c:2826 [inline]
       tcp_setsockopt+0x84/0xd0 net/ipv4/tcp.c:2820
       sock_common_setsockopt+0x94/0xd0 net/core/sock.c:2968
       SYSC_setsockopt net/socket.c:1865 [inline]
       SyS_setsockopt+0x13c/0x210 net/socket.c:1844
       do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
       entry_SYSCALL_64_after_hwframe+0x42/0xb7

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-executor587/7242:
 #0:  (&xt[i].mutex){+.+.}, at: [<ffffffff854c922c>] xt_find_table_lock+0x3c/0x3d0 net/netfilter/x_tables.c:1092

stack backtrace:
CPU: 1 PID: 7242 Comm: syz-executor587 Not tainted 4.14.171-syzkaller #0
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+0x142/0x197 lib/dump_stack.c:58
 print_circular_bug.isra.0.cold+0x1cc/0x28f kernel/locking/lockdep.c:1258
 check_prev_add kernel/locking/lockdep.c:1901 [inline]
 check_prevs_add kernel/locking/lockdep.c:2018 [inline]
 validate_chain kernel/locking/lockdep.c:2460 [inline]
 __lock_acquire+0x2cb3/0x4620 kernel/locking/lockdep.c:3487
 lock_acquire+0x16f/0x430 kernel/locking/lockdep.c:3994
 __mutex_lock_common kernel/locking/mutex.c:756 [inline]
 __mutex_lock+0xe8/0x1470 kernel/locking/mutex.c:893
 mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:908
 rtnl_lock+0x17/0x20 net/core/rtnetlink.c:72
 unregister_netdevice_notifier+0x5f/0x2c0 net/core/dev.c:1634
 tee_tg_destroy+0x61/0xc0 net/netfilter/xt_TEE.c:123
 cleanup_entry+0x1a6/0x260 net/ipv6/netfilter/ip6_tables.c:684
 __do_replace+0x3c5/0x5c0 net/ipv6/netfilter/ip6_tables.c:1105
 do_replace net/ipv6/netfilter/ip6_tables.c:1161 [inline]
 do_ip6t_set_ctl+0x296/0x3f4 net/ipv6/netfilter/ip6_tables.c:1685
 nf_sockopt net/netfilter/nf_sockopt.c:106 [inline]
 nf_setsockopt+0x67/0xc0 net/netfilter/nf_sockopt.c:115
 ipv6_setsockopt net/ipv6/ipv6_sockglue.c:930 [inline]
 ipv6_setsockopt+0x105/0x130 net/ipv6/ipv6_sockglue.c:914
 tcp_setsockopt net/ipv4/tcp.c:2826 [inline]
 tcp_setsockopt+0x84/0xd0 net/ipv4/tcp.c:2820
 sock_common_setsockopt+0x94/0xd0 net/core/sock.c:2968
 SYSC_setsockopt net/socket.c:1865 [inline]
 SyS_setsockopt+0x13c/0x210 net/socket.c:1844
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x444a8a
RSP: 002b:00007ffe26544838 EFLAGS: 00000282 ORIG_RAX: 0000000000000036
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000444a8a
RDX: 0000000000000040 RSI: 0000000000000029 RDI: 0000000000000003
RBP: 00007ffe26544960 R08: 00000000000003b8 R09: 0000000000004000
R10: 00000000006ceb60 R11: 0000000000000282 R12: 00007ffe26544860
R13: 00000000006d0d80 R14: 0000000000000029 R15: 00000000006cebc0
ip6_tables: ip6tables: counters copy to user failed while replacing table
ip6_tables: ip6tables: counters copy to user failed while replacing table
ip6_tables: ip6tables: counters copy to user failed while replacing table
ip6_tables: ip6tables: counters copy to user failed while replacing table
ip6_tables: ip6tables: counters copy to user failed while replacing table
ip6_tables: ip6tables: counters copy to user failed while replacing table
ip6_tables: ip6tables: counters copy to user failed while replacing table
ip6_tables: ip6tables: counters copy to user failed while replacing table
ip6_tables: ip6tables: counters copy to user failed while replacing table
net_ratelimit: 82 callbacks suppressed
ip6_tables: ip6tables: counters copy to user failed while replacing table
ip6_tables: ip6tables: counters copy to user failed while replacing table
ip6_tables: ip6tables: counters copy to user failed while replacing table
ip6_tables: ip6tables: counters copy to user failed while replacing table
ip6_tables: ip6tables: counters copy to user failed while replacing table
ip6_tables: ip6tables: counters copy to user failed while replacing table
ip6_tables: ip6tables: counters copy to user failed while replacing table
ip6_tables: ip6tables: counters copy to user failed while replacing table
ip6_tables: ip6tables: counters copy to user failed while replacing table
ip6_tables: ip6tables: counters copy to user failed while replacing table
net_ratelimit: 99 callbacks suppressed
ip6_tables: ip6tables: counters copy to user failed while replacing table

Crashes (312):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-linux-4-14 2020/02/26 06:51 linux-4.14.y 98db2bf27b9e 4f588111 .config log report syz C
ci2-linux-4-14 2020/02/25 17:22 linux-4.14.y 98db2bf27b9e 4c886d6a .config log report syz C
ci2-linux-4-14 2020/02/25 16:12 linux-4.14.y 98db2bf27b9e 4c886d6a .config log report syz C
ci2-linux-4-14 2020/02/23 05:44 linux-4.14.y 98db2bf27b9e 2c36e7a7 .config log report syz C
ci2-linux-4-14 2020/02/04 03:34 linux-4.14.y 9fa690a2a016 93e5e335 .config log report syz C
ci2-linux-4-14 2020/02/04 00:27 linux-4.14.y 9fa690a2a016 93e5e335 .config log report syz C
ci2-linux-4-14 2020/01/28 19:15 linux-4.14.y 9a95f25269bd c8e81ce4 .config log report syz C
ci2-linux-4-14 2020/01/28 07:00 linux-4.14.y 9a95f25269bd 56cd6c9b .config log report syz C
ci2-linux-4-14 2020/01/25 14:44 linux-4.14.y 8bac50406cca 2e95ab33 .config log report syz C
ci2-linux-4-14 2020/01/22 21:41 linux-4.14.y c1141b3aab36 3334d684 .config log report syz C
ci2-linux-4-14 2020/01/19 12:42 linux-4.14.y c1141b3aab36 bc8bc756 .config log report syz C
ci2-linux-4-14 2020/01/17 15:06 linux-4.14.y c04fc6fa5c96 3de7aabb .config log report syz C
ci2-linux-4-14 2020/01/16 12:51 linux-4.14.y c04fc6fa5c96 3de7aabb .config log report syz C
ci2-linux-4-14 2020/01/09 19:20 linux-4.14.y b0cdffaa546e 4de4e9f0 .config log report syz C
ci2-linux-4-14 2020/01/09 04:51 linux-4.14.y 84f5ad468100 ddc3e859 .config log report syz C
ci2-linux-4-14 2020/01/08 12:02 linux-4.14.y 84f5ad468100 ddc3e859 .config log report syz C
ci2-linux-4-14 2020/01/07 01:39 linux-4.14.y 84f5ad468100 53430d97 .config log report syz C
ci2-linux-4-14 2020/01/07 00:17 linux-4.14.y 84f5ad468100 53430d97 .config log report syz C
ci2-linux-4-14 2020/01/06 02:45 linux-4.14.y 84f5ad468100 438e1227 .config log report syz C
ci2-linux-4-14 2020/02/26 05:35 linux-4.14.y 98db2bf27b9e 4f588111 .config log report
ci2-linux-4-14 2020/02/26 02:05 linux-4.14.y 98db2bf27b9e 4f588111 .config log report
ci2-linux-4-14 2020/02/25 14:51 linux-4.14.y 98db2bf27b9e 4c886d6a .config log report
ci2-linux-4-14 2020/02/25 11:43 linux-4.14.y 98db2bf27b9e 59b57593 .config log report
ci2-linux-4-14 2020/02/25 06:30 linux-4.14.y 98db2bf27b9e 59b57593 .config log report
ci2-linux-4-14 2020/02/25 03:52 linux-4.14.y 98db2bf27b9e 59b57593 .config log report
ci2-linux-4-14 2020/02/25 00:57 linux-4.14.y 98db2bf27b9e 59b57593 .config log report
ci2-linux-4-14 2020/02/24 21:29 linux-4.14.y 98db2bf27b9e 1253d6f0 .config log report
ci2-linux-4-14 2020/02/24 19:52 linux-4.14.y 98db2bf27b9e 1253d6f0 .config log report
ci2-linux-4-14 2020/02/24 10:02 linux-4.14.y 98db2bf27b9e 1253d6f0 .config log report
ci2-linux-4-14 2020/02/23 21:22 linux-4.14.y 98db2bf27b9e d801cb02 .config log report
ci2-linux-4-14 2020/02/23 19:27 linux-4.14.y 98db2bf27b9e 2c36e7a7 .config log report
ci2-linux-4-14 2020/02/23 16:06 linux-4.14.y 98db2bf27b9e 2c36e7a7 .config log report
ci2-linux-4-14 2020/02/23 13:36 linux-4.14.y 98db2bf27b9e 2c36e7a7 .config log report
ci2-linux-4-14 2020/02/23 10:11 linux-4.14.y 98db2bf27b9e 2c36e7a7 .config log report
ci2-linux-4-14 2020/02/23 08:01 linux-4.14.y 98db2bf27b9e 2c36e7a7 .config log report
ci2-linux-4-14 2020/02/23 00:57 linux-4.14.y 98db2bf27b9e 2c36e7a7 .config log report
ci2-linux-4-14 2020/02/22 22:36 linux-4.14.y 98db2bf27b9e 2c36e7a7 .config log report
ci2-linux-4-14 2020/02/22 12:51 linux-4.14.y 98db2bf27b9e 2c36e7a7 .config log report
ci2-linux-4-14 2020/02/22 11:51 linux-4.14.y 98db2bf27b9e 2c36e7a7 .config log report
ci2-linux-4-14 2020/02/22 07:17 linux-4.14.y 98db2bf27b9e 2ffa6679 .config log report
ci2-linux-4-14 2020/02/21 18:58 linux-4.14.y 98db2bf27b9e 2ffa6679 .config log report
ci2-linux-4-14 2020/02/21 03:46 linux-4.14.y 98db2bf27b9e bd2a74a3 .config log report
ci2-linux-4-14 2020/02/20 13:15 linux-4.14.y 98db2bf27b9e 81230308 .config log report
ci2-linux-4-14 2020/02/20 01:01 linux-4.14.y 98db2bf27b9e b690a6e3 .config log report
ci2-linux-4-14 2020/02/19 22:59 linux-4.14.y 98db2bf27b9e 47fae6e9 .config log report
ci2-linux-4-14 2020/02/19 18:44 linux-4.14.y 98db2bf27b9e 47fae6e9 .config log report
ci2-linux-4-14 2020/02/19 17:19 linux-4.14.y 98db2bf27b9e 47fae6e9 .config log report
ci2-linux-4-14 2020/02/19 14:05 linux-4.14.y 98db2bf27b9e 47fae6e9 .config log report
ci2-linux-4-14 2020/02/19 13:22 linux-4.14.y 98db2bf27b9e 47fae6e9 .config log report
ci2-linux-4-14 2020/02/19 07:40 linux-4.14.y 98db2bf27b9e 135c18aa .config log report
ci2-linux-4-14 2020/02/19 04:20 linux-4.14.y 98db2bf27b9e 135c18aa .config log report
ci2-linux-4-14 2020/02/19 01:58 linux-4.14.y 98db2bf27b9e 135c18aa .config log report
ci2-linux-4-14 2020/02/19 00:49 linux-4.14.y 98db2bf27b9e 135c18aa .config log report
ci2-linux-4-14 2020/02/18 23:40 linux-4.14.y 98db2bf27b9e 012fbc32 .config log report
ci2-linux-4-14 2020/02/18 22:27 linux-4.14.y 98db2bf27b9e 012fbc32 .config log report
ci2-linux-4-14 2020/02/18 18:57 linux-4.14.y 98db2bf27b9e 012fbc32 .config log report
ci2-linux-4-14 2020/02/18 13:41 linux-4.14.y 98db2bf27b9e 012fbc32 .config log report
ci2-linux-4-14 2020/02/18 12:37 linux-4.14.y 98db2bf27b9e 012fbc32 .config log report
ci2-linux-4-14 2020/02/18 09:03 linux-4.14.y 98db2bf27b9e 1ce142dc .config log report
ci2-linux-4-14 2020/02/18 01:02 linux-4.14.y 98db2bf27b9e 1ce142dc .config log report
ci2-linux-4-14 2020/02/17 19:30 linux-4.14.y 98db2bf27b9e 72bfa6f2 .config log report
ci2-linux-4-14 2020/02/17 13:52 linux-4.14.y 98db2bf27b9e 72bfa6f2 .config log report
ci2-linux-4-14 2020/02/17 12:47 linux-4.14.y 98db2bf27b9e 72bfa6f2 .config log report
ci2-linux-4-14 2020/01/06 01:44 linux-4.14.y 84f5ad468100 438e1227 .config log report