netlink: 28 bytes leftover after parsing attributes in process `syz-executor.0'.
======================================================
WARNING: possible circular locking dependency detected
4.14.299-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.0/15240 is trying to acquire lock:
 (&xt[i].mutex){+.+.}, at: [<ffffffff85f1e83e>] xt_find_target+0x3e/0x1e0 net/netfilter/x_tables.c:232

but task is already holding lock:
 (rtnl_mutex){+.+.}, at: [<ffffffff85c8aa9d>] rtnl_lock net/core/rtnetlink.c:72 [inline]
 (rtnl_mutex){+.+.}, at: [<ffffffff85c8aa9d>] rtnetlink_rcv_msg+0x31d/0xb10 net/core/rtnetlink.c:4317

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (rtnl_mutex){+.+.}:
       __mutex_lock_common kernel/locking/mutex.c:756 [inline]
       __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893
       unregister_netdevice_notifier+0x5e/0x2b0 net/core/dev.c:1630
       tee_tg_destroy+0x5c/0xb0 net/netfilter/xt_TEE.c:123
       cleanup_entry+0x232/0x310 net/ipv6/netfilter/ip6_tables.c:685
       __do_replace+0x38d/0x580 net/ipv4/netfilter/arp_tables.c:930
       do_replace net/ipv6/netfilter/ip6_tables.c:1162 [inline]
       do_ip6t_set_ctl+0x256/0x3b0 net/ipv6/netfilter/ip6_tables.c:1688
       nf_sockopt net/netfilter/nf_sockopt.c:106 [inline]
       nf_setsockopt+0x5f/0xb0 net/netfilter/nf_sockopt.c:115
       ipv6_setsockopt+0xc0/0x120 net/ipv6/ipv6_sockglue.c:937
       tcp_setsockopt+0x7b/0xc0 net/ipv4/tcp.c:2831
       SYSC_setsockopt net/socket.c:1865 [inline]
       SyS_setsockopt+0x110/0x1e0 net/socket.c:1844
       do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
       entry_SYSCALL_64_after_hwframe+0x5e/0xd3

-> #0 (&xt[i].mutex){+.+.}:
       lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998
       __mutex_lock_common kernel/locking/mutex.c:756 [inline]
       __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893
       xt_find_target+0x3e/0x1e0 net/netfilter/x_tables.c:232
       xt_request_find_target net/netfilter/x_tables.c:261 [inline]
       xt_request_find_target+0x72/0xe0 net/netfilter/x_tables.c:254
       ipt_init_target+0xb9/0x250 net/sched/act_ipt.c:45
       __tcf_ipt_init+0x48d/0xc00 net/sched/act_ipt.c:168
       tcf_ipt_init+0x43/0x50 net/sched/act_ipt.c:202
       tcf_action_init_1+0x51a/0x9e0 net/sched/act_api.c:691
       tcf_action_init+0x26d/0x400 net/sched/act_api.c:760
       tcf_action_add net/sched/act_api.c:1088 [inline]
       tc_ctl_action+0x2e3/0x510 net/sched/act_api.c:1140
       rtnetlink_rcv_msg+0x3be/0xb10 net/core/rtnetlink.c:4322
       netlink_rcv_skb+0x125/0x390 net/netlink/af_netlink.c:2454
       netlink_unicast_kernel net/netlink/af_netlink.c:1296 [inline]
       netlink_unicast+0x437/0x610 net/netlink/af_netlink.c:1322
       netlink_sendmsg+0x648/0xbc0 net/netlink/af_netlink.c:1893
       sock_sendmsg_nosec net/socket.c:646 [inline]
       sock_sendmsg+0xb5/0x100 net/socket.c:656
       ___sys_sendmsg+0x6c8/0x800 net/socket.c:2062
       __sys_sendmsg+0xa3/0x120 net/socket.c:2096
       SYSC_sendmsg net/socket.c:2107 [inline]
       SyS_sendmsg+0x27/0x40 net/socket.c:2103
       do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
       entry_SYSCALL_64_after_hwframe+0x5e/0xd3

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(rtnl_mutex);
                               lock(&xt[i].mutex);
                               lock(rtnl_mutex);
  lock(&xt[i].mutex);

 *** DEADLOCK ***

1 lock held by syz-executor.0/15240:
 #0:  (rtnl_mutex){+.+.}, at: [<ffffffff85c8aa9d>] rtnl_lock net/core/rtnetlink.c:72 [inline]
 #0:  (rtnl_mutex){+.+.}, at: [<ffffffff85c8aa9d>] rtnetlink_rcv_msg+0x31d/0xb10 net/core/rtnetlink.c:4317

stack backtrace:
CPU: 0 PID: 15240 Comm: syz-executor.0 Not tainted 4.14.299-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x1b2/0x281 lib/dump_stack.c:58
 print_circular_bug.constprop.0.cold+0x2d7/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+0x2e0e/0x3f20 kernel/locking/lockdep.c:3491
 lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998
 __mutex_lock_common kernel/locking/mutex.c:756 [inline]
 __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893
 xt_find_target+0x3e/0x1e0 net/netfilter/x_tables.c:232
 xt_request_find_target net/netfilter/x_tables.c:261 [inline]
 xt_request_find_target+0x72/0xe0 net/netfilter/x_tables.c:254
 ipt_init_target+0xb9/0x250 net/sched/act_ipt.c:45
 __tcf_ipt_init+0x48d/0xc00 net/sched/act_ipt.c:168
 tcf_ipt_init+0x43/0x50 net/sched/act_ipt.c:202
 tcf_action_init_1+0x51a/0x9e0 net/sched/act_api.c:691
 tcf_action_init+0x26d/0x400 net/sched/act_api.c:760
 tcf_action_add net/sched/act_api.c:1088 [inline]
 tc_ctl_action+0x2e3/0x510 net/sched/act_api.c:1140
 rtnetlink_rcv_msg+0x3be/0xb10 net/core/rtnetlink.c:4322
 netlink_rcv_skb+0x125/0x390 net/netlink/af_netlink.c:2454
 netlink_unicast_kernel net/netlink/af_netlink.c:1296 [inline]
 netlink_unicast+0x437/0x610 net/netlink/af_netlink.c:1322
 netlink_sendmsg+0x648/0xbc0 net/netlink/af_netlink.c:1893
 sock_sendmsg_nosec net/socket.c:646 [inline]
 sock_sendmsg+0xb5/0x100 net/socket.c:656
 ___sys_sendmsg+0x6c8/0x800 net/socket.c:2062
 __sys_sendmsg+0xa3/0x120 net/socket.c:2096
 SYSC_sendmsg net/socket.c:2107 [inline]
 SyS_sendmsg+0x27/0x40 net/socket.c:2103
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x5e/0xd3
x_tables: ip_tables: .0 target: invalid size 8 (kernel) != (user) 6
netlink: 28 bytes leftover after parsing attributes in process `syz-executor.0'.
x_tables: ip_tables: .0 target: invalid size 8 (kernel) != (user) 6
netlink: 28 bytes leftover after parsing attributes in process `syz-executor.0'.
x_tables: ip_tables: .0 target: invalid size 8 (kernel) != (user) 6
[EXT4 FS bs=2048, gc=1, bpg=262144, ipg=32, mo=a816e018, mo2=0002]
System zones: 0-7
EXT4-fs (loop4): mounted filesystem without journal. Opts: grpquota,barrier,debug,debug_want_extra_isize=0x0000000000000004,i_version,nouid32,sysvgroups,inode_readahead_blks=0x0000000000000000,jqfmt=vfsv0,max_batch_time=0x0000000000000004,,errors=continue
kauditd_printk_skb: 56 callbacks suppressed
audit: type=1804 audit(1669137199.852:122): pid=15403 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.4" name="/root/syzkaller-testdir3329874402/syzkaller.Rktq3O/177/file0/bus" dev="loop4" ino=18 res=1
[EXT4 FS bs=2048, gc=1, bpg=262144, ipg=32, mo=a816e018, mo2=0002]
print_req_error: I/O error, dev loop4, sector 0
System zones: 0-7
EXT4-fs (loop2): mounted filesystem without journal. Opts: grpquota,barrier,debug,debug_want_extra_isize=0x0000000000000004,i_version,nouid32,sysvgroups,inode_readahead_blks=0x0000000000000000,jqfmt=vfsv0,max_batch_time=0x0000000000000004,,errors=continue
[EXT4 FS bs=2048, gc=1, bpg=262144, ipg=32, mo=a816e018, mo2=0002]
System zones: 0-7
audit: type=1804 audit(1669137200.592:123): pid=15450 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.2" name="/root/syzkaller-testdir1102024785/syzkaller.ZyD4YT/175/file0/bus" dev="loop2" ino=18 res=1
EXT4-fs (loop4): mounted filesystem without journal. Opts: grpquota,barrier,debug,debug_want_extra_isize=0x0000000000000004,i_version,nouid32,sysvgroups,inode_readahead_blks=0x0000000000000000,jqfmt=vfsv0,max_batch_time=0x0000000000000004,,errors=continue
audit: type=1804 audit(1669137200.692:124): pid=15446 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.4" name="/root/syzkaller-testdir3329874402/syzkaller.Rktq3O/178/file0/bus" dev="loop4" ino=18 res=1
[EXT4 FS bs=2048, gc=1, bpg=262144, ipg=32, mo=a816e018, mo2=0002]
System zones: 0-7
EXT4-fs (loop2): mounted filesystem without journal. Opts: grpquota,barrier,debug,debug_want_extra_isize=0x0000000000000004,i_version,nouid32,sysvgroups,inode_readahead_blks=0x0000000000000000,jqfmt=vfsv0,max_batch_time=0x0000000000000004,,errors=continue
audit: type=1804 audit(1669137201.252:125): pid=15474 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.2" name="/root/syzkaller-testdir1102024785/syzkaller.ZyD4YT/176/file0/bus" dev="loop2" ino=18 res=1
[EXT4 FS bs=2048, gc=1, bpg=262144, ipg=32, mo=a816e018, mo2=0002]
System zones: 0-7
EXT4-fs (loop4): mounted filesystem without journal. Opts: grpquota,barrier,debug,debug_want_extra_isize=0x0000000000000004,i_version,nouid32,sysvgroups,inode_readahead_blks=0x0000000000000000,jqfmt=vfsv0,max_batch_time=0x0000000000000004,,errors=continue
device bond1 entered promiscuous mode
audit: type=1804 audit(1669137201.442:126): pid=15491 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.4" name="/root/syzkaller-testdir3329874402/syzkaller.Rktq3O/179/file0/bus" dev="loop4" ino=18 res=1
IPv6: ADDRCONF(NETDEV_UP): bond1: link is not ready
[EXT4 FS bs=2048, gc=1, bpg=262144, ipg=32, mo=a816e018, mo2=0002]
8021q: adding VLAN 0 to HW filter on device bond1
System zones: 0-7
EXT4-fs (loop2): mounted filesystem without journal. Opts: grpquota,barrier,debug,debug_want_extra_isize=0x0000000000000004,i_version,nouid32,sysvgroups,inode_readahead_blks=0x0000000000000000,jqfmt=vfsv0,max_batch_time=0x0000000000000004,,errors=continue
audit: type=1804 audit(1669137201.622:127): pid=15542 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.2" name="/root/syzkaller-testdir1102024785/syzkaller.ZyD4YT/177/file0/bus" dev="loop2" ino=18 res=1
[EXT4 FS bs=2048, gc=1, bpg=262144, ipg=32, mo=a816e018, mo2=0002]
System zones: 0-7
EXT4-fs (loop4): mounted filesystem without journal. Opts: grpquota,barrier,debug,debug_want_extra_isize=0x0000000000000004,i_version,nouid32,sysvgroups,inode_readahead_blks=0x0000000000000000,jqfmt=vfsv0,max_batch_time=0x0000000000000004,,errors=continue
audit: type=1804 audit(1669137201.822:128): pid=15587 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.2" name="/root/syzkaller-testdir1102024785/syzkaller.ZyD4YT/178/bus" dev="sda1" ino=13887 res=1
audit: type=1804 audit(1669137201.822:129): pid=15587 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="ToMToU" comm="syz-executor.2" name="/root/syzkaller-testdir1102024785/syzkaller.ZyD4YT/178/bus" dev="sda1" ino=13887 res=1
device bond2 entered promiscuous mode
IPv6: ADDRCONF(NETDEV_UP): bond2: link is not ready
8021q: adding VLAN 0 to HW filter on device bond2
audit: type=1804 audit(1669137201.822:130): pid=15587 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="ToMToU" comm="syz-executor.2" name="/root/syzkaller-testdir1102024785/syzkaller.ZyD4YT/178/bus" dev="sda1" ino=13887 res=1
audit: type=1804 audit(1669137201.822:131): pid=15587 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.2" name="/root/syzkaller-testdir1102024785/syzkaller.ZyD4YT/178/bus" dev="sda1" ino=13887 res=1
device bond1 entered promiscuous mode
IPv6: ADDRCONF(NETDEV_UP): bond1: link is not ready
8021q: adding VLAN 0 to HW filter on device bond1
device bond1 entered promiscuous mode
IPv6: ADDRCONF(NETDEV_UP): bond1: link is not ready
8021q: adding VLAN 0 to HW filter on device bond1
device bond3 entered promiscuous mode
IPv6: ADDRCONF(NETDEV_UP): bond3: link is not ready
8021q: adding VLAN 0 to HW filter on device bond3