====================================================== WARNING: possible circular locking dependency detected 4.15.0-rc9+ #217 Not tainted ------------------------------------------------------ syz-executor0/5930 is trying to acquire lock: (&xt[i].mutex){+.+.}, at: [<00000000b2cf81d1>] xt_find_target+0x44/0x1e0 net/netfilter/x_tables.c:229 but task is already holding lock: (sk_lock-AF_INET6){+.+.}, at: [<00000000ab262b07>] lock_sock include/net/sock.h:1463 [inline] (sk_lock-AF_INET6){+.+.}, at: [<00000000ab262b07>] ipv6_setsockopt+0xff/0x150 net/ipv6/ipv6_sockglue.c:927 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (sk_lock-AF_INET6){+.+.}: lock_sock_nested+0xc2/0x110 net/core/sock.c:2780 lock_sock include/net/sock.h:1463 [inline] do_ipv6_setsockopt.isra.8+0x3c5/0x39d0 net/ipv6/ipv6_sockglue.c:167 ipv6_setsockopt+0xd7/0x150 net/ipv6/ipv6_sockglue.c:922 udpv6_setsockopt+0x45/0x80 net/ipv6/udp.c:1422 sock_common_setsockopt+0x95/0xd0 net/core/sock.c:2978 SYSC_setsockopt net/socket.c:1849 [inline] SyS_setsockopt+0x189/0x360 net/socket.c:1828 entry_SYSCALL_64_fastpath+0x29/0xa0 -> #1 (rtnl_mutex){+.+.}: __mutex_lock_common kernel/locking/mutex.c:756 [inline] __mutex_lock+0x16f/0x1a80 kernel/locking/mutex.c:893 mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:908 rtnl_lock+0x17/0x20 net/core/rtnetlink.c:74 unregister_netdevice_notifier+0x91/0x4e0 net/core/dev.c:1673 tee_tg_destroy+0x61/0xc0 net/netfilter/xt_TEE.c:123 cleanup_entry+0x218/0x350 net/ipv4/netfilter/ip_tables.c:659 __do_replace+0x79d/0xa50 net/ipv4/netfilter/ip_tables.c:1094 do_replace net/ipv4/netfilter/ip_tables.c:1150 [inline] do_ipt_set_ctl+0x40f/0x5f0 net/ipv4/netfilter/ip_tables.c:1680 nf_sockopt net/netfilter/nf_sockopt.c:106 [inline] nf_setsockopt+0x67/0xc0 net/netfilter/nf_sockopt.c:115 ip_setsockopt+0xa1/0xb0 net/ipv4/ip_sockglue.c:1260 sctp_setsockopt+0x2b6/0x61d0 net/sctp/socket.c:4141 sock_common_setsockopt+0x95/0xd0 net/core/sock.c:2978 SYSC_setsockopt net/socket.c:1849 [inline] SyS_setsockopt+0x189/0x360 net/socket.c:1828 entry_SYSCALL_64_fastpath+0x29/0xa0 -> #0 (&xt[i].mutex){+.+.}: lock_acquire+0x1d5/0x580 kernel/locking/lockdep.c:3914 __mutex_lock_common kernel/locking/mutex.c:756 [inline] __mutex_lock+0x16f/0x1a80 kernel/locking/mutex.c:893 mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:908 xt_find_target+0x44/0x1e0 net/netfilter/x_tables.c:229 xt_request_find_target+0x2c/0xb0 net/netfilter/x_tables.c:255 find_check_entry.isra.7+0x669/0xcf0 net/ipv6/netfilter/ip6_tables.c:572 translate_table+0xf52/0x1690 net/ipv6/netfilter/ip6_tables.c:749 do_replace net/ipv6/netfilter/ip6_tables.c:1165 [inline] do_ip6t_set_ctl+0x370/0x5f0 net/ipv6/netfilter/ip6_tables.c:1691 nf_sockopt net/netfilter/nf_sockopt.c:106 [inline] nf_setsockopt+0x67/0xc0 net/netfilter/nf_sockopt.c:115 ipv6_setsockopt+0x115/0x150 net/ipv6/ipv6_sockglue.c:928 rawv6_setsockopt+0x4a/0xf0 net/ipv6/raw.c:1060 sock_common_setsockopt+0x95/0xd0 net/core/sock.c:2978 SYSC_setsockopt net/socket.c:1849 [inline] SyS_setsockopt+0x189/0x360 net/socket.c:1828 entry_SYSCALL_64_fastpath+0x29/0xa0 other info that might help us debug this: Chain exists of: &xt[i].mutex --> rtnl_mutex --> sk_lock-AF_INET6 Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(sk_lock-AF_INET6); lock(rtnl_mutex); lock(sk_lock-AF_INET6); lock(&xt[i].mutex); *** DEADLOCK *** 1 lock held by syz-executor0/5930: #0: (sk_lock-AF_INET6){+.+.}, at: [<00000000ab262b07>] lock_sock include/net/sock.h:1463 [inline] #0: (sk_lock-AF_INET6){+.+.}, at: [<00000000ab262b07>] ipv6_setsockopt+0xff/0x150 net/ipv6/ipv6_sockglue.c:927 stack backtrace: CPU: 1 PID: 5930 Comm: syz-executor0 Not tainted 4.15.0-rc9+ #217 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+0x194/0x257 lib/dump_stack.c:53 print_circular_bug.isra.37+0x2cd/0x2dc kernel/locking/lockdep.c:1218 check_prev_add kernel/locking/lockdep.c:1858 [inline] check_prevs_add kernel/locking/lockdep.c:1971 [inline] validate_chain kernel/locking/lockdep.c:2412 [inline] __lock_acquire+0x30a8/0x3e00 kernel/locking/lockdep.c:3426 lock_acquire+0x1d5/0x580 kernel/locking/lockdep.c:3914 __mutex_lock_common kernel/locking/mutex.c:756 [inline] __mutex_lock+0x16f/0x1a80 kernel/locking/mutex.c:893 mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:908 xt_find_target+0x44/0x1e0 net/netfilter/x_tables.c:229 xt_request_find_target+0x2c/0xb0 net/netfilter/x_tables.c:255 find_check_entry.isra.7+0x669/0xcf0 net/ipv6/netfilter/ip6_tables.c:572 translate_table+0xf52/0x1690 net/ipv6/netfilter/ip6_tables.c:749 do_replace net/ipv6/netfilter/ip6_tables.c:1165 [inline] do_ip6t_set_ctl+0x370/0x5f0 net/ipv6/netfilter/ip6_tables.c:1691 nf_sockopt net/netfilter/nf_sockopt.c:106 [inline] nf_setsockopt+0x67/0xc0 net/netfilter/nf_sockopt.c:115 ipv6_setsockopt+0x115/0x150 net/ipv6/ipv6_sockglue.c:928 rawv6_setsockopt+0x4a/0xf0 net/ipv6/raw.c:1060 sock_common_setsockopt+0x95/0xd0 net/core/sock.c:2978 SYSC_setsockopt net/socket.c:1849 [inline] SyS_setsockopt+0x189/0x360 net/socket.c:1828 entry_SYSCALL_64_fastpath+0x29/0xa0 RIP: 0033:0x453299 RSP: 002b:00007fadce38bc58 EFLAGS: 00000212 ORIG_RAX: 0000000000000036 RAX: ffffffffffffffda RBX: 000000000071bea0 RCX: 0000000000453299 RDX: 0000000000000040 RSI: 0000000000000029 RDI: 0000000000000013 RBP: 0000000000000100 R08: 00000000000004a0 R09: 0000000000000000 R10: 0000000020006a60 R11: 0000000000000212 R12: 00000000006f08a0 R13: 00000000ffffffff R14: 00007fadce38c6d4 R15: 0000000000000000 device syz5 left promiscuous mode sctp: [Deprecated]: syz-executor3 (pid 6205) Use of int in max_burst socket option. Use struct sctp_assoc_value instead sctp: [Deprecated]: syz-executor3 (pid 6205) Use of int in max_burst socket option. Use struct sctp_assoc_value instead syz-executor3 (6205) used greatest stack depth: 16288 bytes left Cannot find set identified by id 0 to match Cannot find set identified by id 0 to match netlink: 'syz-executor4': attribute type 21 has an invalid length. kauditd_printk_skb: 18 callbacks suppressed audit: type=1400 audit(1517406407.951:40): avc: denied { bind } for pid=6423 comm="syz-executor6" 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 netlink: 'syz-executor4': attribute type 21 has an invalid length. audit: type=1400 audit(1517406408.061:41): avc: denied { map } for pid=6465 comm="syz-executor4" path=2F616E6F6E5F6875676570616765202864656C6574656429 dev="hugetlbfs" ino=16521 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:hugetlbfs_t:s0 tclass=file permissive=1 audit: type=1400 audit(1517406408.194:42): avc: denied { read } for pid=6499 comm="syz-executor0" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=netlink_generic_socket permissive=1 dccp_xmit_packet: Payload too large (65423) for featneg. audit: type=1400 audit(1517406408.220:43): avc: denied { create } for pid=6497 comm="syz-executor5" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=netlink_crypto_socket permissive=1 audit: type=1400 audit(1517406408.222:44): avc: denied { setopt } for pid=6497 comm="syz-executor5" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=netlink_crypto_socket permissive=1 audit: type=1400 audit(1517406408.293:45): avc: denied { bind } for pid=6501 comm="syz-executor2" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=netlink_generic_socket permissive=1 netlink: 84 bytes leftover after parsing attributes in process `syz-executor4'. netlink: 84 bytes leftover after parsing attributes in process `syz-executor4'. audit: type=1400 audit(1517406408.789:46): avc: denied { accept } for pid=6707 comm="syz-executor2" 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 audit: type=1400 audit(1517406408.820:47): avc: denied { read } for pid=6707 comm="syz-executor2" 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 sock: process `syz-executor5' is using obsolete setsockopt SO_BSDCOMPAT device ip6gre0 entered promiscuous mode rdma_op 000000004f3f1033 conn xmit_rdma (null) raw_sendmsg: syz-executor0 forgot to set AF_INET. Fix it! dccp_close: ABORT with 253 bytes unread netlink: 'syz-executor1': attribute type 21 has an invalid length. netlink: 'syz-executor1': attribute type 21 has an invalid length. syz-executor2 (6910) used greatest stack depth: 15184 bytes left netlink: 'syz-executor6': attribute type 3 has an invalid length. audit: type=1400 audit(1517406409.866:48): avc: denied { accept } for pid=7029 comm="syz-executor6" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tclass=netlink_generic_socket permissive=1 netlink: 'syz-executor6': attribute type 3 has an invalid length. nf_conntrack: default automatic helper assignment has been turned off for security reasons and CT-based firewall rule not found. Use the iptables CT target to attach helpers instead. device syz7 entered promiscuous mode sctp: [Deprecated]: syz-executor0 (pid 7252) Use of int in maxseg socket option. Use struct sctp_assoc_value instead sctp: [Deprecated]: syz-executor0 (pid 7252) Use of int in maxseg socket option. Use struct sctp_assoc_value instead audit: type=1400 audit(1517406410.930:49): avc: denied { write } for pid=7430 comm="syz-executor1" scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=system_u:object_r:unlabeled_t:s0 tclass=socket permissive=1 kasan: CONFIG_KASAN_INLINE enabled kasan: GPF could be caused by NULL-ptr deref or user memory access general protection fault: 0000 [#1] SMP KASAN Dumping ftrace buffer: dccp_invalid_packet: P.Data Offset(0) too small (ftrace buffer empty) Modules linked in: CPU: 1 PID: 7551 Comm: syz-executor6 Not tainted 4.15.0-rc9+ #217 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:ip6t_do_table+0x12de/0x19d0 net/ipv6/netfilter/ip6_tables.c:360 RSP: 0018:ffff8801b1e66768 EFLAGS: 00010246 RAX: 0000000000000000 RBX: ffff8801b6434040 RCX: ffffffff84d6bbb2 RDX: 0000000000000357 RSI: 0000000000000000 RDI: ffff8801b643419e RBP: ffff8801b1e66970 R08: ffff8801b1e66a68 R09: 0000000000000000 R10: 00000000000000d0 R11: ffffffff86b41580 R12: 0000000000000001 R13: 0000000000000000 R14: dffffc0000000000 R15: ffff8801b6434110 FS: 00007fbd46aa9700(0000) GS:ffff8801db500000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ffd88624dec CR3: 00000001b54aa002 CR4: 00000000001606e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: ip6table_security_hook+0x65/0x80 net/ipv6/netfilter/ip6table_security.c:45 nf_hook_entry_hookfn include/linux/netfilter.h:120 [inline] nf_hook_slow+0xba/0x1a0 net/netfilter/core.c:483 nf_hook include/linux/netfilter.h:243 [inline] NF_HOOK include/linux/netfilter.h:286 [inline] ip6_input+0x35c/0x560 net/ipv6/ip6_input.c:327 ip6_mc_input+0x3a8/0xb10 net/ipv6/ip6_input.c:404 dst_input include/net/dst.h:449 [inline] ip6_rcv_finish+0x297/0x8c0 net/ipv6/ip6_input.c:71 NF_HOOK include/linux/netfilter.h:288 [inline] ipv6_rcv+0xf37/0x1fa0 net/ipv6/ip6_input.c:208 __netif_receive_skb_core+0x1a41/0x3460 net/core/dev.c:4547 __netif_receive_skb+0x2c/0x1b0 net/core/dev.c:4612 netif_receive_skb_internal+0x10b/0x670 net/core/dev.c:4686 netif_receive_skb+0xae/0x390 net/core/dev.c:4710 tun_rx_batched.isra.52+0x5ee/0x870 drivers/net/tun.c:1558 tun_get_user+0x25de/0x3940 drivers/net/tun.c:1958 tun_chr_write_iter+0xb9/0x160 drivers/net/tun.c:1986 call_write_iter include/linux/fs.h:1772 [inline] do_iter_readv_writev+0x525/0x7f0 fs/read_write.c:653 do_iter_write+0x154/0x540 fs/read_write.c:932 vfs_writev+0x18a/0x340 fs/read_write.c:977 do_writev+0xfc/0x2a0 fs/read_write.c:1012 SYSC_writev fs/read_write.c:1085 [inline] SyS_writev+0x27/0x30 fs/read_write.c:1082 entry_SYSCALL_64_fastpath+0x29/0xa0 RIP: 0033:0x453171 RSP: 002b:00007fbd46aa8b80 EFLAGS: 00000293 ORIG_RAX: 0000000000000014 RAX: ffffffffffffffda RBX: 000000000071bea0 RCX: 0000000000453171 RDX: 0000000000000001 RSI: 00007fbd46aa8bd0 RDI: 0000000000000012 RBP: 0000000000000026 R08: 0000000000000000 R09: 0000000000000000 R10: 000000000000004a R11: 0000000000000293 R12: 00000000006ef430 R13: 00000000ffffffff R14: 00007fbd46aa96d4 R15: 0000000000000000 Code: 41 f6 87 83 00 00 00 04 75 37 e8 8e 75 99 fc 8b 85 54 fe ff ff 48 8b b5 90 fe ff ff 4c 8d 2c c6 44 8d 60 01 4c 89 e8 48 c1 e8 03 <42> 80 3c 30 00 0f 85 5c 03 00 00 4d 89 7d 00 44 89 a5 54 fe ff RIP: ip6t_do_table+0x12de/0x19d0 net/ipv6/netfilter/ip6_tables.c:360 RSP: ffff8801b1e66768 ---[ end trace b6563f62496c9cbc ]---