syzbot


possible deadlock in match_revfn (2)

Status: upstream: reported on 2021/12/04 10:49
Reported-by: syzbot+6050d3d48ec4b617809e@syzkaller.appspotmail.com
First crash: 1085d, last: 636d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 possible deadlock in match_revfn 418 1209d 1346d 0/1 auto-closed as invalid on 2021/10/30 21:02

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
======================================================
WARNING: possible circular locking dependency detected
4.14.307-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.1/12949 is trying to acquire lock:
 (&xt[i].mutex){+.+.}, at: [<ffffffff85f21683>] match_revfn+0x43/0x210 net/netfilter/x_tables.c:332

but task is already holding lock:
 (&table[i].mutex){+.+.}, at: [<ffffffff85e4d3b6>] nfnl_lock net/netfilter/nfnetlink.c:61 [inline]
 (&table[i].mutex){+.+.}, at: [<ffffffff85e4d3b6>] nfnetlink_rcv_msg+0x726/0xc00 net/netfilter/nfnetlink.c:209

which lock already depends on the new lock.

audit: type=1804 audit(1677363805.907:111): pid=12954 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.3" name="/root/syzkaller-testdir3553625244/syzkaller.dN5Br4/79/bus" dev="sda1" ino=13970 res=1

the existing dependency chain (in reverse order) is:

-> #2 (&table[i].mutex){+.+.}:
       __mutex_lock_common kernel/locking/mutex.c:756 [inline]
       __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893
       nf_tables_netdev_event+0x10d/0x4d0 net/netfilter/nf_tables_netdev.c:122
       notifier_call_chain+0x108/0x1a0 kernel/notifier.c:93
       call_netdevice_notifiers_info net/core/dev.c:1667 [inline]
       call_netdevice_notifiers net/core/dev.c:1683 [inline]
       rollback_registered_many+0x765/0xbb0 net/core/dev.c:7211
       rollback_registered+0xca/0x170 net/core/dev.c:7253
       unregister_netdevice_queue+0x1b4/0x360 net/core/dev.c:8274
       unregister_netdevice include/linux/netdevice.h:2444 [inline]
       ppp_release+0x177/0x1a0 drivers/net/ppp/ppp_generic.c:410
       __fput+0x25f/0x7a0 fs/file_table.c:210
       task_work_run+0x11f/0x190 kernel/task_work.c:113
       tracehook_notify_resume include/linux/tracehook.h:191 [inline]
       exit_to_usermode_loop+0x1ad/0x200 arch/x86/entry/common.c:164
       prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline]
       syscall_return_slowpath arch/x86/entry/common.c:270 [inline]
       do_syscall_64+0x4a3/0x640 arch/x86/entry/common.c:297
       entry_SYSCALL_64_after_hwframe+0x5e/0xd3

-> #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+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
       raw_setsockopt+0xac/0xd0 net/ipv4/raw.c:860
       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
       match_revfn+0x43/0x210 net/netfilter/x_tables.c:332
       xt_find_revision+0x8d/0x1d0 net/netfilter/x_tables.c:380
       nfnl_compat_get+0x1f7/0x870 net/netfilter/nft_compat.c:678
       nfnetlink_rcv_msg+0x9bb/0xc00 net/netfilter/nfnetlink.c:214
       netlink_rcv_skb+0x125/0x390 net/netlink/af_netlink.c:2461
       nfnetlink_rcv+0x1ab/0x1da0 net/netfilter/nfnetlink.c:515
       netlink_unicast_kernel net/netlink/af_netlink.c:1302 [inline]
       netlink_unicast+0x437/0x610 net/netlink/af_netlink.c:1328
       netlink_sendmsg+0x651/0xbc0 net/netlink/af_netlink.c:1900
       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:

Chain exists of:
  &xt[i].mutex --> rtnl_mutex --> &table[i].mutex

 Possible unsafe locking scenario:

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

 *** DEADLOCK ***

1 lock held by syz-executor.1/12949:
 #0:  (&table[i].mutex){+.+.}, at: [<ffffffff85e4d3b6>] nfnl_lock net/netfilter/nfnetlink.c:61 [inline]
 #0:  (&table[i].mutex){+.+.}, at: [<ffffffff85e4d3b6>] nfnetlink_rcv_msg+0x726/0xc00 net/netfilter/nfnetlink.c:209

stack backtrace:
CPU: 1 PID: 12949 Comm: syz-executor.1 Not tainted 4.14.307-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/16/2023
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
 match_revfn+0x43/0x210 net/netfilter/x_tables.c:332
 xt_find_revision+0x8d/0x1d0 net/netfilter/x_tables.c:380
 nfnl_compat_get+0x1f7/0x870 net/netfilter/nft_compat.c:678
 nfnetlink_rcv_msg+0x9bb/0xc00 net/netfilter/nfnetlink.c:214
 netlink_rcv_skb+0x125/0x390 net/netlink/af_netlink.c:2461
 nfnetlink_rcv+0x1ab/0x1da0 net/netfilter/nfnetlink.c:515
 netlink_unicast_kernel net/netlink/af_netlink.c:1302 [inline]
 netlink_unicast+0x437/0x610 net/netlink/af_netlink.c:1328
 netlink_sendmsg+0x651/0xbc0 net/netlink/af_netlink.c:1900
 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
RIP: 0033:0x7f9a1721c0f9
RSP: 002b:00007f9a1578e168 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007f9a1733bf80 RCX: 00007f9a1721c0f9
RDX: 0000000000000000 RSI: 00000000200001c0 RDI: 0000000000000003
RBP: 00007f9a17277ae9 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fff3534b21f R14: 00007f9a1578e300 R15: 0000000000022000
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
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
base_sock_release(ffff88804bbfc580) sk=          (null)
sch_tbf: burst 0 is lower than device lo mtu (65550) !
base_sock_release(ffff88804bbfca00) sk=ffff8880b3c8e9c0
base_sock_release(ffff88805f29ba00) sk=          (null)
sch_tbf: burst 0 is lower than device lo mtu (65550) !
base_sock_release(ffff88808e219200) sk=ffff8880557392c0
base_sock_release(ffff88804a416900) sk=          (null)
sch_tbf: burst 0 is lower than device lo mtu (65550) !
base_sock_release(ffff88804a404180) sk=ffff888056ae15c0
base_sock_release(ffff88805f26b900) sk=          (null)
sch_tbf: burst 0 is lower than device lo mtu (65550) !
base_sock_release(ffff88805f1e4640) sk=ffff888051c58b00
base_sock_release(ffff88804a463ac0) sk=          (null)
sch_tbf: burst 0 is lower than device lo mtu (65550) !
base_sock_release(ffff88804a462180) sk=ffff8880b4226b80
base_sock_release(ffff88808dff4ac0) sk=          (null)
sch_tbf: burst 0 is lower than device lo mtu (65550) !
base_sock_release(ffff88808dfd7600) sk=ffff8880a8e428c0
base_sock_release(ffff88804a486580) sk=          (null)
sch_tbf: burst 0 is lower than device lo mtu (65550) !
base_sock_release(ffff88804a486a00) sk=ffff8880b4cde1c0
base_sock_release(ffff88804a4a2600) sk=          (null)
sch_tbf: burst 0 is lower than device lo mtu (65550) !
base_sock_release(ffff88804a4a2a80) sk=ffff88809be174c0
base_sock_release(ffff88805f24b9c0) sk=          (null)
sch_tbf: burst 0 is lower than device lo mtu (65550) !
base_sock_release(ffff88805f1ef140) sk=ffff888099069500
base_sock_release(ffff88804a4d04c0) sk=          (null)
sch_tbf: burst 0 is lower than device lo mtu (65550) !
base_sock_release(ffff88804a4d0940) sk=ffff88809d4facc0
base_sock_release(ffff88804a4875c0) sk=          (null)
base_sock_release(ffff888057224a40) sk=ffff88809dd89580
base_sock_release(ffff88804a53c480) sk=          (null)
base_sock_release(ffff88804a53c900) sk=ffff88805b9a8440
base_sock_release(ffff88804a57ba80) sk=          (null)
base_sock_release(ffff88804a57a140) sk=ffff8880a8c74a00
ieee80211 phy2: Selected rate control algorithm 'minstrel_ht'
ieee80211 phy2: hwaddr 02:00:00:00:02:00 registered
ieee80211 phy3: Selected rate control algorithm 'minstrel_ht'
ieee80211 phy3: hwaddr 02:00:00:00:03:00 registered
ieee80211 phy4: Selected rate control algorithm 'minstrel_ht'
ieee80211 phy4: hwaddr 02:00:00:00:04:00 registered
ieee80211 phy5: Selected rate control algorithm 'minstrel_ht'
ieee80211 phy5: hwaddr 02:00:00:00:05:00 registered
audit: type=1800 audit(1677363814.547:112): pid=13361 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed(directio)" comm="syz-executor.0" name="file0" dev="sda1" ino=14324 res=0
audit: type=1804 audit(1677363814.557:113): pid=13361 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.0" name="/root/syzkaller-testdir1440753474/syzkaller.RHZd9z/127/file0" dev="sda1" ino=14324 res=1

Crashes (190):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/02/25 22:23 linux-4.14.y 7878a41b6cc1 ee50e71c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in match_revfn
2023/02/17 12:18 linux-4.14.y a8ad60f2af58 3e7039f4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in match_revfn
2023/02/16 23:29 linux-4.14.y a8ad60f2af58 851bc19a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in match_revfn
2023/02/11 04:55 linux-4.14.y a8ad60f2af58 93e26d60 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in match_revfn
2023/02/02 21:10 linux-4.14.y 3949d1610004 16d19e30 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in match_revfn
2023/01/13 17:29 linux-4.14.y c4215ee4771b 529798b0 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in match_revfn
2023/01/03 19:00 linux-4.14.y c4215ee4771b f0036e18 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in match_revfn
2022/12/21 14:21 linux-4.14.y c4215ee4771b 4067838e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in match_revfn
2022/12/14 20:58 linux-4.14.y c4215ee4771b b18f0a64 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in match_revfn
2022/12/14 02:17 linux-4.14.y 65afe34ac33d f6511626 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in match_revfn
2022/12/06 18:52 linux-4.14.y 179ef7fe8677 d88f3abb .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in match_revfn
2022/11/30 13:55 linux-4.14.y 179ef7fe8677 4c2a66e8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in match_revfn
2022/11/15 22:47 linux-4.14.y e911713e40ca 3a127a31 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in match_revfn
2022/11/01 22:27 linux-4.14.y a85772d7ba90 08977f5d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in match_revfn
2022/10/28 02:01 linux-4.14.y 41f36d7859a7 5c716ff6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in match_revfn
2022/10/27 00:21 linux-4.14.y 41f36d7859a7 86777b7f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 possible deadlock in match_revfn
2022/10/25 08:42 linux-4.14.y 9d5c0b3a8e1a 45645420 .config console log report info [disk image] [vmlinux] ci2-linux-4-14 possible deadlock in match_revfn
2022/10/20 20:41 linux-4.14.y 9d5c0b3a8e1a a0fd4dab .config console log report info [disk image] [vmlinux] ci2-linux-4-14 possible deadlock in match_revfn
2022/10/17 16:24 linux-4.14.y 9d5c0b3a8e1a 94744d21 .config console log report info [disk image] [vmlinux] ci2-linux-4-14 possible deadlock in match_revfn
2022/10/15 01:48 linux-4.14.y 9d5c0b3a8e1a 67cb024c .config console log report info [disk image] [vmlinux] ci2-linux-4-14 possible deadlock in match_revfn
2022/10/12 17:27 linux-4.14.y 9d5c0b3a8e1a 16a9c9e0 .config console log report info [disk image] [vmlinux] ci2-linux-4-14 possible deadlock in match_revfn
2022/10/11 00:07 linux-4.14.y 9d5c0b3a8e1a 5bcf0c31 .config console log report info [disk image] [vmlinux] ci2-linux-4-14 possible deadlock in match_revfn
2022/10/07 12:42 linux-4.14.y 9d5c0b3a8e1a 79a59635 .config console log report info [disk image] [vmlinux] ci2-linux-4-14 possible deadlock in match_revfn
2022/09/26 14:40 linux-4.14.y 4edbf74132a4 d59ba983 .config console log report info ci2-linux-4-14 possible deadlock in match_revfn
2022/09/21 12:53 linux-4.14.y 4edbf74132a4 380f82fb .config console log report info [disk image] [vmlinux] ci2-linux-4-14 possible deadlock in match_revfn
2022/09/20 20:08 linux-4.14.y 4edbf74132a4 c4b8ccfd .config console log report info [disk image] [vmlinux] ci2-linux-4-14 possible deadlock in match_revfn
2022/09/06 10:46 linux-4.14.y 65640c873dcf 65aea2b9 .config console log report info [disk image] [vmlinux] ci2-linux-4-14 possible deadlock in match_revfn
2022/08/16 05:05 linux-4.14.y b641242202ed 7a7cb304 .config console log report info ci2-linux-4-14 possible deadlock in match_revfn
2022/08/05 11:10 linux-4.14.y b641242202ed a65a7ce9 .config console log report info ci2-linux-4-14 possible deadlock in match_revfn
2022/07/27 00:12 linux-4.14.y 9c3bf9cf362f ae971e66 .config console log report info ci2-linux-4-14 possible deadlock in match_revfn
2022/07/26 12:55 linux-4.14.y 9c3bf9cf362f 279b89c2 .config console log report info ci2-linux-4-14 possible deadlock in match_revfn
2022/07/26 10:54 linux-4.14.y 9c3bf9cf362f 279b89c2 .config console log report info ci2-linux-4-14 possible deadlock in match_revfn
2022/07/25 06:20 linux-4.14.y 9c3bf9cf362f 22343af4 .config console log report info ci2-linux-4-14 possible deadlock in match_revfn
2022/07/11 14:38 linux-4.14.y 1048779a1d7d f3f217ff .config console log report info ci2-linux-4-14 possible deadlock in match_revfn
2022/07/11 10:08 linux-4.14.y 1048779a1d7d f3f217ff .config console log report info ci2-linux-4-14 possible deadlock in match_revfn
2022/07/09 10:47 linux-4.14.y 1048779a1d7d b5765a15 .config console log report info ci2-linux-4-14 possible deadlock in match_revfn
2022/07/08 12:12 linux-4.14.y 1048779a1d7d 8442e655 .config console log report info ci2-linux-4-14 possible deadlock in match_revfn
2022/07/02 18:00 linux-4.14.y ed2e96e11936 1434eec0 .config console log report info ci2-linux-4-14 possible deadlock in match_revfn
2022/06/27 13:28 linux-4.14.y f051383ef03b a371c43c .config console log report info ci2-linux-4-14 possible deadlock in match_revfn
2022/06/24 16:21 linux-4.14.y 84bae26850e3 a371c43c .config console log report info ci2-linux-4-14 possible deadlock in match_revfn
2022/06/24 13:21 linux-4.14.y 84bae26850e3 a371c43c .config console log report info ci2-linux-4-14 possible deadlock in match_revfn
2022/06/22 16:17 linux-4.14.y 84bae26850e3 912f5df7 .config console log report info ci2-linux-4-14 possible deadlock in match_revfn
2022/06/17 20:11 linux-4.14.y 84bae26850e3 8f633d84 .config console log report info ci2-linux-4-14 possible deadlock in match_revfn
2022/06/17 08:11 linux-4.14.y 84bae26850e3 cb58b3b2 .config console log report info ci2-linux-4-14 possible deadlock in match_revfn
2022/06/14 19:49 linux-4.14.y 1ccc597f801c 127d1faf .config console log report info ci2-linux-4-14 possible deadlock in match_revfn
2022/06/13 17:15 linux-4.14.y b8f3be299d51 0f087040 .config console log report info ci2-linux-4-14 possible deadlock in match_revfn
2022/06/07 16:57 linux-4.14.y b8f3be299d51 b2706118 .config console log report info ci2-linux-4-14 possible deadlock in match_revfn
2022/06/03 14:34 linux-4.14.y 501eec4f9e13 eee80d3c .config console log report info ci2-linux-4-14 possible deadlock in match_revfn
2022/05/27 22:27 linux-4.14.y 501eec4f9e13 a46af346 .config console log report info ci2-linux-4-14 possible deadlock in match_revfn
2022/05/24 12:22 linux-4.14.y dffb5c6ff09c fcfad4ff .config console log report info ci2-linux-4-14 possible deadlock in match_revfn
2022/05/12 15:38 linux-4.14.y 569d1abf9402 9ad6612a .config console log report info ci2-linux-4-14 possible deadlock in match_revfn
2021/12/04 10:48 linux-4.14.y 66722c42ec91 a617004c .config console log report info ci2-linux-4-14 possible deadlock in match_revfn
* Struck through repros no longer work on HEAD.