syzbot


possible deadlock in xt_find_target

Status: upstream: reported C repro on 2020/01/12 00:39
Reported-by: syzbot+682e88cf0cbf9bf5d093@syzkaller.appspotmail.com
First crash: 1501d, last: 372d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in xt_find_target netfilter 34 2208d 2215d 4/26 fixed on 2018/02/04 23:45
Fix bisection attempts (7)
Created Duration User Patch Repo Result
2022/11/07 08:22 28m bisect fix linux-4.14.y job log (0) log
2021/11/30 17:21 30m bisect fix linux-4.14.y job log (0) log
2021/10/31 16:40 25m bisect fix linux-4.14.y job log (0) log
2021/10/01 15:38 29m bisect fix linux-4.14.y job log (0) log
2021/09/01 15:11 26m bisect fix linux-4.14.y job log (0) log
2021/08/02 14:46 24m bisect fix linux-4.14.y job log (0) log
2021/07/03 14:23 23m bisect fix linux-4.14.y job log (0) log

Sample crash report:
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
netlink: 4 bytes leftover after parsing attributes in process `syz-executor076'.
======================================================
WARNING: possible circular locking dependency detected
4.14.177-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor076/6368 is trying to acquire lock:
 (&xt[i].mutex){+.+.}, at: [<ffffffff852c47ed>] xt_find_target+0x3d/0x1e0 net/netfilter/x_tables.c:232

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

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+0xe8/0x1470 kernel/locking/mutex.c:893
       unregister_netdevice_notifier+0x5e/0x2b0 net/core/dev.c:1634
       tee_tg_destroy+0x5c/0xb0 net/netfilter/xt_TEE.c:123
       cleanup_entry+0x169/0x220 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+0x255/0x39d net/ipv4/netfilter/ip_tables.c:1674
       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
       udp_setsockopt+0x45/0x80 net/ipv4/udp.c:2451
       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+0x42/0xb7

-> #0 (&xt[i].mutex){+.+.}:
       lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998
       __mutex_lock_common kernel/locking/mutex.c:756 [inline]
       __mutex_lock+0xe8/0x1470 kernel/locking/mutex.c:893
       xt_find_target+0x3d/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+0xb1/0x240 net/sched/act_ipt.c:45
       __tcf_ipt_init+0x455/0xaf0 net/sched/act_ipt.c:168
       tcf_xt_init+0x43/0x50 net/sched/act_ipt.c:210
       tcf_action_init_1+0x51a/0x9f0 net/sched/act_api.c:682
       tcf_action_init+0x26d/0x400 net/sched/act_api.c:751
       tcf_action_add net/sched/act_api.c:1079 [inline]
       tc_ctl_action+0x2e3/0x513 net/sched/act_api.c:1131
       rtnetlink_rcv_msg+0x3be/0xb10 net/core/rtnetlink.c:4315
       netlink_rcv_skb+0x127/0x370 net/netlink/af_netlink.c:2433
       netlink_unicast_kernel net/netlink/af_netlink.c:1287 [inline]
       netlink_unicast+0x437/0x620 net/netlink/af_netlink.c:1313
       netlink_sendmsg+0x733/0xbe0 net/netlink/af_netlink.c:1878
       sock_sendmsg_nosec net/socket.c:646 [inline]
       sock_sendmsg+0xc5/0x100 net/socket.c:656
       sock_no_sendpage+0xe5/0x110 net/core/sock.c:2572
       kernel_sendpage+0x82/0xd0 net/socket.c:3407
       sock_sendpage+0x84/0xa0 net/socket.c:871
       pipe_to_sendpage+0x226/0x2d0 fs/splice.c:451
       splice_from_pipe_feed fs/splice.c:502 [inline]
       __splice_from_pipe+0x332/0x740 fs/splice.c:626
       splice_from_pipe+0xc6/0x120 fs/splice.c:661
       do_splice_from fs/splice.c:851 [inline]
       do_splice fs/splice.c:1147 [inline]
       SYSC_splice fs/splice.c:1402 [inline]
       SyS_splice+0xca0/0x1230 fs/splice.c:1382
       do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
       entry_SYSCALL_64_after_hwframe+0x42/0xb7

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 ***

2 locks held by syz-executor076/6368:
 #0:  (&pipe->mutex/1){+.+.}, at: [<ffffffff818cbfe8>] pipe_lock_nested fs/pipe.c:67 [inline]
 #0:  (&pipe->mutex/1){+.+.}, at: [<ffffffff818cbfe8>] pipe_lock+0x58/0x70 fs/pipe.c:75
 #1:  (rtnl_mutex){+.+.}, at: [<ffffffff8502d5ed>] rtnl_lock net/core/rtnetlink.c:72 [inline]
 #1:  (rtnl_mutex){+.+.}, at: [<ffffffff8502d5ed>] rtnetlink_rcv_msg+0x31d/0xb10 net/core/rtnetlink.c:4310

stack backtrace:
CPU: 0 PID: 6368 Comm: syz-executor076 Not tainted 4.14.177-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+0x13e/0x194 lib/dump_stack.c:58
 print_circular_bug.isra.0.cold+0x1c4/0x282 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+0x2cb3/0x4620 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+0xe8/0x1470 kernel/locking/mutex.c:893
 xt_find_target+0x3d/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+0xb1/0x240 net/sched/act_ipt.c:45
 __tcf_ipt_init+0x455/0xaf0 net/sched/act_ipt.c:168
 tcf_xt_init+0x43/0x50 net/sched/act_ipt.c:210
 tcf_action_init_1+0x51a/0x9f0 net/sched/act_api.c:682
 tcf_action_init+0x26d/0x400 net/sched/act_api.c:751
 tcf_action_add net/sched/act_api.c:1079 [inline]
 tc_ctl_action+0x2e3/0x513 net/sched/act_api.c:1131
 rtnetlink_rcv_msg+0x3be/0xb10 net/core/rtnetlink.c:4315
 netlink_rcv_skb+0x127/0x370 net/netlink/af_netlink.c:2433
 netlink_unicast_kernel net/netlink/af_netlink.c:1287 [inline]
 netlink_unicast+0x437/0x620 net/netlink/af_netlink.c:1313
 netlink_sendmsg+0x733/0xbe0 net/netlink/af_netlink.c:1878
 sock_sendmsg_nosec net/socket.c:646 [inline]
 sock_sendmsg+0xc5/0x100 net/socket.c:656
 sock_no_sendpage+0xe5/0x110 net/core/sock.c:2572
 kernel_sendpage+0x82/0xd0 net/socket.c:3407
 sock_sendpage+0x84/0xa0 net/socket.c:871
 pipe_to_sendpage+0x226/0x2d0 fs/splice.c:451
 splice_from_pipe_feed fs/splice.c:502 [inline]
 __splice_from_pipe+0x332/0x740 fs/splice.c:626
 splice_from_pipe+0xc6/0x120 fs/splice.c:661
 do_splice_from fs/splice.c:851 [inline]
 do_splice fs/splice.c:1147 [inline]
 SYSC_splice fs/splice.c:1402 [inline]
 SyS_splice+0xca0/0x1230 fs/splice.c:1382
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x447639
RSP: 002b:00007f5837541d88 EFLAGS: 00000246 ORIG_RAX: 0000000000000113
RAX: ffffffffffffffda RBX: 00000000006dcc68 RCX: 0000000000447639
RDX: 0000000000000006 RSI: 0000000000000000 RDI: 0000000000000004
RBP: 00000000006dcc60 R08: 000000000004ffe0 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000006dcc6c
R13: 0000000000000000 R14: 0000000000000000 R15: 6570797472646461

Crashes (2922):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/04/29 07:45 linux-4.14.y 050272a0423e e3ecea2e .config console log report syz C ci2-linux-4-14
2023/02/13 19:33 linux-4.14.y a8ad60f2af58 957959cb .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in xt_find_target
2023/01/23 08:37 linux-4.14.y 97205fccccdc 44388686 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in xt_find_target
2023/01/09 23:54 linux-4.14.y c4215ee4771b 48bc529a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in xt_find_target
2022/11/22 17:13 linux-4.14.y e911713e40ca 9da37ae8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in xt_find_target
2022/10/07 12:53 linux-4.14.y 9d5c0b3a8e1a 79a59635 .config console log report info [disk image] [vmlinux] ci2-linux-4-14 possible deadlock in xt_find_target
2022/10/05 22:34 linux-4.14.y 9d5c0b3a8e1a 2c6543ad .config console log report info [disk image] [vmlinux] ci2-linux-4-14 possible deadlock in xt_find_target
2022/09/21 13:58 linux-4.14.y 4edbf74132a4 380f82fb .config console log report info [disk image] [vmlinux] ci2-linux-4-14 possible deadlock in xt_find_target
2022/09/12 19:54 linux-4.14.y 65640c873dcf f371ed7e .config console log report info [disk image] [vmlinux] ci2-linux-4-14 possible deadlock in xt_find_target
2022/09/05 23:44 linux-4.14.y 65640c873dcf 9dcd38fc .config console log report info [disk image] [vmlinux] ci2-linux-4-14 possible deadlock in xt_find_target
2022/09/05 14:23 linux-4.14.y 65640c873dcf 922294ab .config console log report info [disk image] [vmlinux] ci2-linux-4-14 possible deadlock in xt_find_target
2022/09/03 18:08 linux-4.14.y e548869f356f 28811d0a .config console log report info [disk image] [vmlinux] ci2-linux-4-14 possible deadlock in xt_find_target
2022/09/03 04:25 linux-4.14.y e548869f356f 49e94a20 .config console log report info [disk image] [vmlinux] ci2-linux-4-14 possible deadlock in xt_find_target
2022/09/02 15:50 linux-4.14.y e548869f356f 25194605 .config console log report info [disk image] [vmlinux] ci2-linux-4-14 possible deadlock in xt_find_target
2022/08/19 00:26 linux-4.14.y b641242202ed 26a13b38 .config console log report info ci2-linux-4-14 possible deadlock in xt_find_target
2022/08/09 20:04 linux-4.14.y b641242202ed c2a623d6 .config console log report info ci2-linux-4-14 possible deadlock in xt_find_target
2022/08/08 19:20 linux-4.14.y b641242202ed da700653 .config console log report info ci2-linux-4-14 possible deadlock in xt_find_target
2022/08/08 16:25 linux-4.14.y b641242202ed da700653 .config console log report info ci2-linux-4-14 possible deadlock in xt_find_target
2022/08/06 00:31 linux-4.14.y b641242202ed e853abd9 .config console log report info ci2-linux-4-14 possible deadlock in xt_find_target
2022/07/29 19:53 linux-4.14.y b641242202ed fef302b1 .config console log report info ci2-linux-4-14 possible deadlock in xt_find_target
2022/07/26 00:06 linux-4.14.y 9c3bf9cf362f 34795c51 .config console log report info ci2-linux-4-14 possible deadlock in xt_find_target
2022/07/21 11:37 linux-4.14.y 424a46ea058e 6e67af9d .config console log report info ci2-linux-4-14 possible deadlock in xt_find_target
2022/07/21 09:01 linux-4.14.y 424a46ea058e 6e67af9d .config console log report info ci2-linux-4-14 possible deadlock in xt_find_target
2022/07/09 22:55 linux-4.14.y 1048779a1d7d b5765a15 .config console log report info ci2-linux-4-14 possible deadlock in xt_find_target
2022/06/24 08:31 linux-4.14.y 84bae26850e3 a5dbd430 .config console log report info ci2-linux-4-14 possible deadlock in xt_find_target
2022/06/17 10:14 linux-4.14.y 84bae26850e3 cb58b3b2 .config console log report info ci2-linux-4-14 possible deadlock in xt_find_target
2022/06/17 07:32 linux-4.14.y 84bae26850e3 cb58b3b2 .config console log report info ci2-linux-4-14 possible deadlock in xt_find_target
2022/06/06 09:32 linux-4.14.y b8f3be299d51 c8857892 .config console log report info ci2-linux-4-14 possible deadlock in xt_find_target
2022/06/03 11:39 linux-4.14.y 501eec4f9e13 eee80d3c .config console log report info ci2-linux-4-14 possible deadlock in xt_find_target
2022/05/31 11:46 linux-4.14.y 501eec4f9e13 af70c3a9 .config console log report info ci2-linux-4-14 possible deadlock in xt_find_target
2022/05/30 18:37 linux-4.14.y 501eec4f9e13 af70c3a9 .config console log report info ci2-linux-4-14 possible deadlock in xt_find_target
2022/05/24 23:16 linux-4.14.y dffb5c6ff09c 647c0e27 .config console log report info ci2-linux-4-14 possible deadlock in xt_find_target
2022/05/23 14:17 linux-4.14.y dffb5c6ff09c 4c7657cb .config console log report info ci2-linux-4-14 possible deadlock in xt_find_target
2022/05/20 18:40 linux-4.14.y dffb5c6ff09c bd37ad7e .config console log report info ci2-linux-4-14 possible deadlock in xt_find_target
2022/05/18 09:23 linux-4.14.y dffb5c6ff09c 744a39e2 .config console log report info ci2-linux-4-14 possible deadlock in xt_find_target
2022/05/18 01:29 linux-4.14.y 690285a9380d 744a39e2 .config console log report info ci2-linux-4-14 possible deadlock in xt_find_target
2022/05/08 18:25 linux-4.14.y e3a56aaade89 e60b1103 .config console log report info ci2-linux-4-14 possible deadlock in xt_find_target
2022/05/06 02:47 linux-4.14.y e3a56aaade89 efeff0a5 .config console log report info ci2-linux-4-14 possible deadlock in xt_find_target
2022/05/05 11:31 linux-4.14.y e3a56aaade89 b3f09415 .config console log report info ci2-linux-4-14 possible deadlock in xt_find_target
2022/05/03 06:01 linux-4.14.y e3a56aaade89 2df221f6 .config console log report info ci2-linux-4-14 possible deadlock in xt_find_target
2022/04/28 17:36 linux-4.14.y e3a56aaade89 e9076525 .config console log report info ci2-linux-4-14 possible deadlock in xt_find_target
2022/04/28 17:15 linux-4.14.y e3a56aaade89 e9076525 .config console log report info ci2-linux-4-14 possible deadlock in xt_find_target
2022/04/27 14:33 linux-4.14.y e3a56aaade89 1fa34c1b .config console log report info ci2-linux-4-14 possible deadlock in xt_find_target
2022/04/27 12:02 linux-4.14.y e3a56aaade89 1fa34c1b .config console log report info ci2-linux-4-14 possible deadlock in xt_find_target
2021/01/17 12:11 linux-4.14.y f79dc86058bc 813be542 .config console log report info ci2-linux-4-14
2020/01/12 00:38 linux-4.14.y b0cdffaa546e 4c04afaa .config console log report ci2-linux-4-14
* Struck through repros no longer work on HEAD.