[v6.1] possible deadlock in ip_set_nfnl_get_byindex

0 views
Skip to first unread message

syzbot

unread,
Mar 20, 2026, 8:14:27 PM (10 hours ago) Mar 20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: f2ddafa93a25 Linux 6.1.166
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=10f4b572580000
kernel config: https://syzkaller.appspot.com/x/.config?x=f0605c5af04d7603
dashboard link: https://syzkaller.appspot.com/bug?extid=3125af22c963aedea860
compiler: Debian clang version 21.1.8 (++20251221033036+2078da43e25a-1~exp1~20251221153213.50), Debian LLD 21.1.8

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/5d86a86f0032/disk-f2ddafa9.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/aafc10ea040b/vmlinux-f2ddafa9.xz
kernel image: https://storage.googleapis.com/syzbot-assets/f6b46858e7a5/bzImage-f2ddafa9.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+3125af...@syzkaller.appspotmail.com

======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.0.1342/9940 is trying to acquire lock:
ffffffff9701ff38 (nfnl_subsys_ipset){+.+.}-{3:3}, at: ip_set_nfnl_get_byindex+0x63/0x230 net/netfilter/ipset/ip_set_core.c:911

but task is already holding lock:
ffff888019e4d4b8 (&nft_net->commit_mutex){+.+.}-{3:3}, at: nf_tables_valid_genid+0x37/0x100 net/netfilter/nf_tables_api.c:10236

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&nft_net->commit_mutex){+.+.}-{3:3}:
__mutex_lock_common kernel/locking/mutex.c:603 [inline]
__mutex_lock+0x12d/0xaf0 kernel/locking/mutex.c:747
nf_tables_dumpreset_obj+0x6e/0x90 net/netfilter/nf_tables_api.c:7511
netlink_dump+0x6a3/0xd00 net/netlink/af_netlink.c:2236
__netlink_dump_start+0x537/0x6f0 net/netlink/af_netlink.c:2338
netlink_dump_start include/linux/netlink.h:269 [inline]
nft_netlink_dump_start_rcu+0xdb/0x1a0 net/netfilter/nf_tables_api.c:1089
nf_tables_getobj_reset+0x1cb/0x610 net/netfilter/nf_tables_api.c:7646
nfnetlink_rcv_msg+0x8a0/0x12b0 net/netfilter/nfnetlink.c:290
netlink_rcv_skb+0x1fb/0x450 net/netlink/af_netlink.c:2511
nfnetlink_rcv+0x2b0/0x2480 net/netfilter/nfnetlink.c:659
netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline]
netlink_unicast+0x74d/0x8d0 net/netlink/af_netlink.c:1344
netlink_sendmsg+0x8ad/0xbd0 net/netlink/af_netlink.c:1872
sock_sendmsg_nosec net/socket.c:718 [inline]
__sock_sendmsg net/socket.c:730 [inline]
____sys_sendmsg+0x5be/0x970 net/socket.c:2518
___sys_sendmsg+0x2a2/0x360 net/socket.c:2572
__sys_sendmsg net/socket.c:2601 [inline]
__do_sys_sendmsg net/socket.c:2610 [inline]
__se_sys_sendmsg+0x1bb/0x2a0 net/socket.c:2608
do_syscall_x64 arch/x86/entry/common.c:46 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #1 (nlk_cb_mutex-NETFILTER){+.+.}-{3:3}:
__mutex_lock_common kernel/locking/mutex.c:603 [inline]
__mutex_lock+0x12d/0xaf0 kernel/locking/mutex.c:747
__netlink_dump_start+0x11f/0x6f0 net/netlink/af_netlink.c:2305
netlink_dump_start include/linux/netlink.h:269 [inline]
ip_set_dump+0x152/0x1e0 net/netfilter/ipset/ip_set_core.c:1719
nfnetlink_rcv_msg+0xbec/0x12b0 net/netfilter/nfnetlink.c:302
netlink_rcv_skb+0x1fb/0x450 net/netlink/af_netlink.c:2511
nfnetlink_rcv+0x2b0/0x2480 net/netfilter/nfnetlink.c:659
netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline]
netlink_unicast+0x74d/0x8d0 net/netlink/af_netlink.c:1344
netlink_sendmsg+0x8ad/0xbd0 net/netlink/af_netlink.c:1872
sock_sendmsg_nosec net/socket.c:718 [inline]
__sock_sendmsg net/socket.c:730 [inline]
____sys_sendmsg+0x5be/0x970 net/socket.c:2518
___sys_sendmsg+0x2a2/0x360 net/socket.c:2572
__sys_sendmsg net/socket.c:2601 [inline]
__do_sys_sendmsg net/socket.c:2610 [inline]
__se_sys_sendmsg+0x1bb/0x2a0 net/socket.c:2608
do_syscall_x64 arch/x86/entry/common.c:46 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
entry_SYSCALL_64_after_hwframe+0x68/0xd2

-> #0 (nfnl_subsys_ipset){+.+.}-{3:3}:
check_prev_add kernel/locking/lockdep.c:3090 [inline]
check_prevs_add kernel/locking/lockdep.c:3209 [inline]
validate_chain kernel/locking/lockdep.c:3825 [inline]
__lock_acquire+0x2d07/0x7d10 kernel/locking/lockdep.c:5049
lock_acquire+0x1bb/0x4a0 kernel/locking/lockdep.c:5662
__mutex_lock_common kernel/locking/mutex.c:603 [inline]
__mutex_lock+0x12d/0xaf0 kernel/locking/mutex.c:747
ip_set_nfnl_get_byindex+0x63/0x230 net/netfilter/ipset/ip_set_core.c:911
set_match_v1_checkentry+0x6d/0x220 net/netfilter/xt_set.c:139
xt_check_match+0x425/0xaf0 net/netfilter/x_tables.c:523
__nft_match_init+0x663/0x890 net/netfilter/nft_compat.c:522
nf_tables_newexpr net/netfilter/nf_tables_api.c:3065 [inline]
nf_tables_newrule+0x1731/0x2810 net/netfilter/nf_tables_api.c:3792
nfnetlink_rcv_batch net/netfilter/nfnetlink.c:519 [inline]
nfnetlink_rcv_skb_batch net/netfilter/nfnetlink.c:639 [inline]
nfnetlink_rcv+0x1124/0x2480 net/netfilter/nfnetlink.c:657
netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline]
netlink_unicast+0x74d/0x8d0 net/netlink/af_netlink.c:1344
netlink_sendmsg+0x8ad/0xbd0 net/netlink/af_netlink.c:1872
sock_sendmsg_nosec net/socket.c:718 [inline]
__sock_sendmsg net/socket.c:730 [inline]
____sys_sendmsg+0x5be/0x970 net/socket.c:2518
___sys_sendmsg+0x2a2/0x360 net/socket.c:2572
__sys_sendmsg net/socket.c:2601 [inline]
__do_sys_sendmsg net/socket.c:2610 [inline]
__se_sys_sendmsg+0x1bb/0x2a0 net/socket.c:2608
do_syscall_x64 arch/x86/entry/common.c:46 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
entry_SYSCALL_64_after_hwframe+0x68/0xd2

other info that might help us debug this:

Chain exists of:
nfnl_subsys_ipset --> nlk_cb_mutex-NETFILTER --> &nft_net->commit_mutex

Possible unsafe locking scenario:

CPU0 CPU1
---- ----
lock(&nft_net->commit_mutex);
lock(nlk_cb_mutex-NETFILTER);
lock(&nft_net->commit_mutex);
lock(nfnl_subsys_ipset);

*** DEADLOCK ***

1 lock held by syz.0.1342/9940:
#0: ffff888019e4d4b8 (&nft_net->commit_mutex){+.+.}-{3:3}, at: nf_tables_valid_genid+0x37/0x100 net/netfilter/nf_tables_api.c:10236

stack backtrace:
CPU: 1 PID: 9940 Comm: syz.0.1342 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2026
Call Trace:
<TASK>
dump_stack_lvl+0x188/0x24e lib/dump_stack.c:106
check_noncircular+0x296/0x330 kernel/locking/lockdep.c:2170
check_prev_add kernel/locking/lockdep.c:3090 [inline]
check_prevs_add kernel/locking/lockdep.c:3209 [inline]
validate_chain kernel/locking/lockdep.c:3825 [inline]
__lock_acquire+0x2d07/0x7d10 kernel/locking/lockdep.c:5049
lock_acquire+0x1bb/0x4a0 kernel/locking/lockdep.c:5662
__mutex_lock_common kernel/locking/mutex.c:603 [inline]
__mutex_lock+0x12d/0xaf0 kernel/locking/mutex.c:747
ip_set_nfnl_get_byindex+0x63/0x230 net/netfilter/ipset/ip_set_core.c:911
set_match_v1_checkentry+0x6d/0x220 net/netfilter/xt_set.c:139
xt_check_match+0x425/0xaf0 net/netfilter/x_tables.c:523
__nft_match_init+0x663/0x890 net/netfilter/nft_compat.c:522
nf_tables_newexpr net/netfilter/nf_tables_api.c:3065 [inline]
nf_tables_newrule+0x1731/0x2810 net/netfilter/nf_tables_api.c:3792
nfnetlink_rcv_batch net/netfilter/nfnetlink.c:519 [inline]
nfnetlink_rcv_skb_batch net/netfilter/nfnetlink.c:639 [inline]
nfnetlink_rcv+0x1124/0x2480 net/netfilter/nfnetlink.c:657
netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline]
netlink_unicast+0x74d/0x8d0 net/netlink/af_netlink.c:1344
netlink_sendmsg+0x8ad/0xbd0 net/netlink/af_netlink.c:1872
sock_sendmsg_nosec net/socket.c:718 [inline]
__sock_sendmsg net/socket.c:730 [inline]
____sys_sendmsg+0x5be/0x970 net/socket.c:2518
___sys_sendmsg+0x2a2/0x360 net/socket.c:2572
__sys_sendmsg net/socket.c:2601 [inline]
__do_sys_sendmsg net/socket.c:2610 [inline]
__se_sys_sendmsg+0x1bb/0x2a0 net/socket.c:2608
do_syscall_x64 arch/x86/entry/common.c:46 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76
entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7fbecc39c799
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fbecd2df028 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007fbecc615fa0 RCX: 00007fbecc39c799
RDX: 0000000024044010 RSI: 0000200000000100 RDI: 0000000000000003
RBP: 00007fbecc432c99 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fbecc616038 R14: 00007fbecc615fa0 R15: 00007ffc1716dec8
</TASK>
Cannot find set identified by id 0 to match


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup
Reply all
Reply to author
Forward
0 new messages