ip_tables: iptables: counters copy to user failed while replacing table : renamed from syz_tun ====================================================== WARNING: possible circular locking dependency detected 4.14.303-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.5/7991 is trying to acquire lock: (rtnl_mutex){+.+.}, at: [] unregister_netdevice_notifier+0x5e/0x2b0 net/core/dev.c:1630 but task is already holding lock: (&xt[i].mutex){+.+.}, at: [] xt_find_table_lock+0x38/0x3d0 net/netfilter/x_tables.c:1088 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&xt[i].mutex){+.+.}: __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 -> #0 (rtnl_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 unregister_netdevice_notifier+0x5e/0x2b0 net/core/dev.c:1630 tee_tg_destroy+0x5c/0xb0 net/netfilter/xt_TEE.c:123 cleanup_entry+0x1fd/0x2d0 net/ipv4/netfilter/ip_tables.c:666 __do_replace+0x38d/0x570 net/ipv4/netfilter/ip_tables.c:1086 do_replace net/ipv4/netfilter/ip_tables.c:1142 [inline] do_ipt_set_ctl+0x256/0x3a0 net/ipv4/netfilter/ip_tables.c:1676 nf_sockopt net/netfilter/nf_sockopt.c:106 [inline] nf_setsockopt+0x5f/0xb0 net/netfilter/nf_sockopt.c:115 ip_setsockopt net/ipv4/ip_sockglue.c:1255 [inline] ip_setsockopt+0x94/0xb0 net/ipv4/ip_sockglue.c:1240 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 other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&xt[i].mutex); lock(rtnl_mutex); lock(&xt[i].mutex); lock(rtnl_mutex); *** DEADLOCK *** 1 lock held by syz-executor.5/7991: #0: (&xt[i].mutex){+.+.}, at: [] xt_find_table_lock+0x38/0x3d0 net/netfilter/x_tables.c:1088 stack backtrace: CPU: 0 PID: 7991 Comm: syz-executor.5 Not tainted 4.14.303-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/12/2023 kauditd_printk_skb: 6 callbacks suppressed audit: type=1804 audit(1674281299.700:33): pid=11104 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.3" name="/root/syzkaller-testdir1449800521/syzkaller.CQbkLU/70/bus" dev="sda1" ino=13966 res=1 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 audit: type=1804 audit(1674281299.750:34): pid=11105 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="ToMToU" comm="syz-executor.3" name="/root/syzkaller-testdir1449800521/syzkaller.CQbkLU/70/bus" dev="sda1" ino=13966 res=1 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 unregister_netdevice_notifier+0x5e/0x2b0 net/core/dev.c:1630 tee_tg_destroy+0x5c/0xb0 net/netfilter/xt_TEE.c:123 cleanup_entry+0x1fd/0x2d0 net/ipv4/netfilter/ip_tables.c:666 __do_replace+0x38d/0x570 net/ipv4/netfilter/ip_tables.c:1086 do_replace net/ipv4/netfilter/ip_tables.c:1142 [inline] do_ipt_set_ctl+0x256/0x3a0 net/ipv4/netfilter/ip_tables.c:1676 nf_sockopt net/netfilter/nf_sockopt.c:106 [inline] nf_setsockopt+0x5f/0xb0 net/netfilter/nf_sockopt.c:115 ip_setsockopt net/ipv4/ip_sockglue.c:1255 [inline] ip_setsockopt+0x94/0xb0 net/ipv4/ip_sockglue.c:1240 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 RIP: 0033:0x7f62ca74971a RSP: 002b:00007ffc98c60298 EFLAGS: 00000202 ORIG_RAX: 0000000000000036 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f62ca74971a RDX: 0000000000000040 RSI: 0000000000000000 RDI: 0000000000000003 RBP: 00007ffc98c602c0 R08: 00000000000002d8 R09: ffffffffff000000 R10: 00007f62ca841d80 R11: 0000000000000202 R12: 00007ffc98c60320 R13: 0000000000000003 R14: 00007ffc98c602bc R15: 00007f62ca841d20 ip_tables: iptables: counters copy to user failed while replacing table : renamed from syz_tun ip_tables: iptables: counters copy to user failed while replacing table ip_tables: iptables: counters copy to user failed while replacing table : renamed from syz_tun device syz_tun entered promiscuous mode device syz_tun left promiscuous mode audit: type=1804 audit(1674281300.990:35): pid=11166 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.5" name="/root/syzkaller-testdir459779442/syzkaller.2CYOD4/62/bus" dev="sda1" ino=14004 res=1 device syz_tun entered promiscuous mode device syz_tun left promiscuous mode audit: type=1804 audit(1674281301.010:36): pid=11166 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.5" name="/root/syzkaller-testdir459779442/syzkaller.2CYOD4/62/bus" dev="sda1" ino=14004 res=1 device syz_tun entered promiscuous mode device syz_tun left promiscuous mode audit: type=1804 audit(1674281301.140:37): pid=11185 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.5" name="/root/syzkaller-testdir459779442/syzkaller.2CYOD4/63/bus" dev="sda1" ino=13965 res=1 audit: type=1804 audit(1674281301.140:38): pid=11185 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.5" name="/root/syzkaller-testdir459779442/syzkaller.2CYOD4/63/bus" dev="sda1" ino=13965 res=1 audit: type=1804 audit(1674281301.780:39): pid=11200 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.5" name="/root/syzkaller-testdir459779442/syzkaller.2CYOD4/64/bus" dev="sda1" ino=14138 res=1 device syz_tun entered promiscuous mode audit: type=1804 audit(1674281301.780:40): pid=11201 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.4" name="/root/syzkaller-testdir1204748787/syzkaller.DON0ug/54/bus" dev="sda1" ino=14141 res=1 device syz_tun left promiscuous mode audit: type=1804 audit(1674281301.800:41): pid=11200 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.5" name="/root/syzkaller-testdir459779442/syzkaller.2CYOD4/64/bus" dev="sda1" ino=14138 res=1 audit: type=1804 audit(1674281301.810:42): pid=11201 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.4" name="/root/syzkaller-testdir1204748787/syzkaller.DON0ug/54/bus" dev="sda1" ino=14141 res=1 overlayfs: unrecognized mount option "index=ogf" or missing value kauditd_printk_skb: 19 callbacks suppressed audit: type=1800 audit(1674281305.000:62): pid=11277 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed(directio)" comm="syz-executor.4" name="file0" dev="sda1" ino=14165 res=0 audit: type=1804 audit(1674281305.000:63): pid=11277 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.4" name="/root/syzkaller-testdir1204748787/syzkaller.DON0ug/61/file0" dev="sda1" ino=14165 res=1 audit: type=1800 audit(1674281305.110:64): pid=11279 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed(directio)" comm="syz-executor.0" name="file0" dev="sda1" ino=14166 res=0 overlayfs: unrecognized mount option "index=ogf" or missing value audit: type=1804 audit(1674281305.140:65): pid=11279 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.0" name="/root/syzkaller-testdir1042147539/syzkaller.QPVSPX/72/file0" dev="sda1" ino=14166 res=1 audit: type=1804 audit(1674281305.140:66): pid=11279 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="ToMToU" comm="syz-executor.0" name="/root/syzkaller-testdir1042147539/syzkaller.QPVSPX/72/file0" dev="sda1" ino=14166 res=1 overlayfs: unrecognized mount option "index=ogf" or missing value audit: type=1800 audit(1674281306.200:67): pid=11291 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed(directio)" comm="syz-executor.2" name="file0" dev="sda1" ino=14171 res=0 audit: type=1804 audit(1674281306.210:68): pid=11291 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.2" name="/root/syzkaller-testdir732050069/syzkaller.Xl0tdy/64/file0" dev="sda1" ino=14171 res=1 audit: type=1800 audit(1674281306.860:69): pid=11298 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed(directio)" comm="syz-executor.4" name="file0" dev="sda1" ino=14173 res=0 audit: type=1800 audit(1674281306.900:70): pid=11301 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed(directio)" comm="syz-executor.0" name="file0" dev="sda1" ino=14174 res=0 audit: type=1804 audit(1674281306.930:71): pid=11298 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.4" name="/root/syzkaller-testdir1204748787/syzkaller.DON0ug/62/file0" dev="sda1" ino=14173 res=1