[v6.1] possible deadlock in nfnl_lock

0 views
Skip to first unread message

syzbot

unread,
Apr 16, 2026, 5:12:37 PM (4 days ago) Apr 16
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 8e8fc038cad5 Linux 6.1.168
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=14f31a6a580000
kernel config: https://syzkaller.appspot.com/x/.config?x=b1adc0bfde2d8a4a
dashboard link: https://syzkaller.appspot.com/bug?extid=a9ab45feff737e3ff03a
compiler: Debian clang version 21.1.8 (++20251221033036+2078da43e25a-1~exp1~20251221153213.50), Debian LLD 21.1.8
userspace arch: arm64

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/1821c80470d7/disk-8e8fc038.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/289636f01a54/vmlinux-8e8fc038.xz
kernel image: https://storage.googleapis.com/syzbot-assets/580462ce5f63/Image-8e8fc038.gz.xz

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

======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz.6.1946/11554 is trying to acquire lock:
ffff80001c87d178 (nfnl_subsys_ipset){+.+.}-{3:3}, at: nfnl_lock+0x50/0x78 net/netfilter/nfnetlink.c:98

but task is already holding lock:
ffff0000d17bfab8 (&nft_net->commit_mutex){+.+.}-{3:3}, at: nf_tables_valid_genid+0x44/0x11c net/netfilter/nf_tables_api.c:10232

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+0x190/0x1f60 kernel/locking/mutex.c:603
__mutex_lock kernel/locking/mutex.c:747 [inline]
mutex_lock_nested+0x38/0x44 kernel/locking/mutex.c:799
nf_tables_dumpreset_obj+0x78/0xa8 net/netfilter/nf_tables_api.c:7511
netlink_dump+0x570/0xb18 net/netlink/af_netlink.c:2236
__netlink_dump_start+0x47c/0x698 net/netlink/af_netlink.c:2338
netlink_dump_start include/linux/netlink.h:269 [inline]
nft_netlink_dump_start_rcu+0xec/0x1a8 net/netfilter/nf_tables_api.c:1089
nf_tables_getobj_reset+0x188/0x534 net/netfilter/nf_tables_api.c:7646
nfnetlink_rcv_msg+0x6d4/0xfac net/netfilter/nfnetlink.c:290
netlink_rcv_skb+0x218/0x3e8 net/netlink/af_netlink.c:2511
nfnetlink_rcv+0x214/0x1bfc net/netfilter/nfnetlink.c:659
netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline]
netlink_unicast+0x60c/0x814 net/netlink/af_netlink.c:1344
netlink_sendmsg+0x6f4/0x9c0 net/netlink/af_netlink.c:1872
sock_sendmsg_nosec net/socket.c:718 [inline]
__sock_sendmsg net/socket.c:730 [inline]
____sys_sendmsg+0x5c8/0x938 net/socket.c:2518
___sys_sendmsg net/socket.c:2572 [inline]
__sys_sendmsg+0x288/0x374 net/socket.c:2601
__do_sys_sendmsg net/socket.c:2610 [inline]
__se_sys_sendmsg net/socket.c:2608 [inline]
__arm64_sys_sendmsg+0x80/0x94 net/socket.c:2608
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b4 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140
do_el0_svc+0x58/0x130 arch/arm64/kernel/syscall.c:204
el0_svc+0x58/0x128 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

-> #1 (nlk_cb_mutex-NETFILTER){+.+.}-{3:3}:
__mutex_lock_common+0x190/0x1f60 kernel/locking/mutex.c:603
__mutex_lock kernel/locking/mutex.c:747 [inline]
mutex_lock_nested+0x38/0x44 kernel/locking/mutex.c:799
__netlink_dump_start+0x104/0x698 net/netlink/af_netlink.c:2305
netlink_dump_start include/linux/netlink.h:269 [inline]
ip_set_dump+0x130/0x1b8 net/netfilter/ipset/ip_set_core.c:1719
nfnetlink_rcv_msg+0xad0/0xfac net/netfilter/nfnetlink.c:302
netlink_rcv_skb+0x218/0x3e8 net/netlink/af_netlink.c:2511
nfnetlink_rcv+0x214/0x1bfc net/netfilter/nfnetlink.c:659
netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline]
netlink_unicast+0x60c/0x814 net/netlink/af_netlink.c:1344
netlink_sendmsg+0x6f4/0x9c0 net/netlink/af_netlink.c:1872
sock_sendmsg_nosec net/socket.c:718 [inline]
__sock_sendmsg net/socket.c:730 [inline]
____sys_sendmsg+0x5c8/0x938 net/socket.c:2518
___sys_sendmsg net/socket.c:2572 [inline]
__sys_sendmsg+0x288/0x374 net/socket.c:2601
__do_sys_sendmsg net/socket.c:2610 [inline]
__se_sys_sendmsg net/socket.c:2608 [inline]
__arm64_sys_sendmsg+0x80/0x94 net/socket.c:2608
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b4 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140
do_el0_svc+0x58/0x130 arch/arm64/kernel/syscall.c:204
el0_svc+0x58/0x128 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

-> #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+0x2880/0x6800 kernel/locking/lockdep.c:5049
lock_acquire+0x20c/0x63c kernel/locking/lockdep.c:5662
__mutex_lock_common+0x190/0x1f60 kernel/locking/mutex.c:603
__mutex_lock kernel/locking/mutex.c:747 [inline]
mutex_lock_nested+0x38/0x44 kernel/locking/mutex.c:799
nfnl_lock+0x50/0x78 net/netfilter/nfnetlink.c:98
ip_set_nfnl_get_byindex+0x7c/0x258 net/netfilter/ipset/ip_set_core.c:911
set_match_v1_checkentry+0x70/0x228 net/netfilter/xt_set.c:139
xt_check_match+0x3d8/0xa48 net/netfilter/x_tables.c:534
__nft_match_init+0x508/0x6d8 net/netfilter/nft_compat.c:522
nft_match_init+0x38/0x4c net/netfilter/nft_compat.c:529
nf_tables_newexpr net/netfilter/nf_tables_api.c:3065 [inline]
nf_tables_newrule+0x1174/0x1b70 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+0xc7c/0x1bfc net/netfilter/nfnetlink.c:657
netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline]
netlink_unicast+0x60c/0x814 net/netlink/af_netlink.c:1344
netlink_sendmsg+0x6f4/0x9c0 net/netlink/af_netlink.c:1872
sock_sendmsg_nosec net/socket.c:718 [inline]
__sock_sendmsg net/socket.c:730 [inline]
____sys_sendmsg+0x5c8/0x938 net/socket.c:2518
___sys_sendmsg net/socket.c:2572 [inline]
__sys_sendmsg+0x288/0x374 net/socket.c:2601
__do_sys_sendmsg net/socket.c:2610 [inline]
__se_sys_sendmsg net/socket.c:2608 [inline]
__arm64_sys_sendmsg+0x80/0x94 net/socket.c:2608
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b4 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140
do_el0_svc+0x58/0x130 arch/arm64/kernel/syscall.c:204
el0_svc+0x58/0x128 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585

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.6.1946/11554:
#0: ffff0000d17bfab8 (&nft_net->commit_mutex){+.+.}-{3:3}, at: nf_tables_valid_genid+0x44/0x11c net/netfilter/nf_tables_api.c:10232

stack backtrace:
CPU: 1 PID: 11554 Comm: syz.6.1946 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/26/2026
Call trace:
dump_backtrace+0x1c0/0x1ec arch/arm64/kernel/stacktrace.c:158
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165
__dump_stack+0x30/0x40 lib/dump_stack.c:88
dump_stack_lvl+0xf4/0x15c lib/dump_stack.c:106
dump_stack+0x1c/0x5c lib/dump_stack.c:113
print_circular_bug+0x148/0x1b0 kernel/locking/lockdep.c:2048
check_noncircular+0x264/0x2f8 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+0x2880/0x6800 kernel/locking/lockdep.c:5049
lock_acquire+0x20c/0x63c kernel/locking/lockdep.c:5662
__mutex_lock_common+0x190/0x1f60 kernel/locking/mutex.c:603
__mutex_lock kernel/locking/mutex.c:747 [inline]
mutex_lock_nested+0x38/0x44 kernel/locking/mutex.c:799
nfnl_lock+0x50/0x78 net/netfilter/nfnetlink.c:98
ip_set_nfnl_get_byindex+0x7c/0x258 net/netfilter/ipset/ip_set_core.c:911
set_match_v1_checkentry+0x70/0x228 net/netfilter/xt_set.c:139
xt_check_match+0x3d8/0xa48 net/netfilter/x_tables.c:534
__nft_match_init+0x508/0x6d8 net/netfilter/nft_compat.c:522
nft_match_init+0x38/0x4c net/netfilter/nft_compat.c:529
nf_tables_newexpr net/netfilter/nf_tables_api.c:3065 [inline]
nf_tables_newrule+0x1174/0x1b70 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+0xc7c/0x1bfc net/netfilter/nfnetlink.c:657
netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline]
netlink_unicast+0x60c/0x814 net/netlink/af_netlink.c:1344
netlink_sendmsg+0x6f4/0x9c0 net/netlink/af_netlink.c:1872
sock_sendmsg_nosec net/socket.c:718 [inline]
__sock_sendmsg net/socket.c:730 [inline]
____sys_sendmsg+0x5c8/0x938 net/socket.c:2518
___sys_sendmsg net/socket.c:2572 [inline]
__sys_sendmsg+0x288/0x374 net/socket.c:2601
__do_sys_sendmsg net/socket.c:2610 [inline]
__se_sys_sendmsg net/socket.c:2608 [inline]
__arm64_sys_sendmsg+0x80/0x94 net/socket.c:2608
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2b4 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:140
do_el0_svc+0x58/0x130 arch/arm64/kernel/syscall.c:204
el0_svc+0x58/0x128 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:585
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