From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Florian Westphal <fw@strlen.de>
Cc: syzbot <syzbot+ff16b505ec9152e5f448@syzkaller.appspotmail.com>,
coreteam@netfilter.org, davem@davemloft.net, edumazet@google.com,
horms@kernel.org, kadlec@netfilter.org, kuba@kernel.org,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
netfilter-devel@vger.kernel.org, pabeni@redhat.com, phil@nwl.cc,
syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [netfilter?] possible deadlock in nf_tables_dumpreset_obj
Date: Mon, 22 Dec 2025 10:30:55 +0100 [thread overview]
Message-ID: <aUkPz0extqKuB7Bl@chamomile> (raw)
In-Reply-To: <aUkNtgPyic8_fBd5@chamomile>
Sorry, I pressed sent too fast... see below.
On Mon, Dec 22, 2025 at 10:22:02AM +0100, Pablo Neira Ayuso wrote:
> On Mon, Dec 22, 2025 at 12:16:53AM +0100, Florian Westphal wrote:
> > syzbot <syzbot+ff16b505ec9152e5f448@syzkaller.appspotmail.com> wrote:
> > > syz.3.970/9330 is trying to acquire lock:
> > > ffff888012d4ccd8 (&nft_net->commit_mutex){+.+.}-{4:4}, at: nf_tables_dumpreset_obj+0x6f/0xa0 net/netfilter/nf_tables_api.c:8491
> > >
> > > but task is already holding lock:
> > > ffff88802bce36f0 (nlk_cb_mutex-NETFILTER){+.+.}-{4:4}, at: __netlink_dump_start+0x150/0x990 net/netlink/af_netlink.c:2404
> > >
> > > which lock already depends on the new lock.
> >
> > I think this is a real bug:
>
> Yes, I think so too, it was a bad idea to use the commit_mutex for this.
>
> > CPU0: 'nft reset'.
> > CPU1: 'ipset list' (anything in ipset doing a netlink dump op)
> > CPU2: 'iptables-nft -A ... -m set ...'
> >
> > ... can result in:
> >
> > CPU0 CPU1 CPU2
> > ---- ---- ----
> > lock(nlk_cb_mutex-NETFILTER);
> > lock(nfnl_subsys_ipset);
> > lock(&nft_net->commit_mutex);
> > lock(nlk_cb_mutex-NETFILTER);
> > lock(nfnl_subsys_ipset);
> > lock(&nft_net->commit_mutex);
Would it work to use a separated mutex for reset itself?
> > CPU0 is waiting for CPU2 to release transaction mutex.
> > CPU1 is waiting for CPU0 to release the netlink dump mutex
> > CPU2 is waiting for CPU1 to release the ipset subsys mutex
> >
> > This bug was added when 'nft reset' started to grab the transaction
> > mutex from the dump callback path in nf_tables.
> >
> > Not yet sure how to avoid it.
> > Maybe we could get rid of 'lock(nfnl_subsys_ipset);'
> > from the xt_set module call paths.
> >
> > Or add a new lock (spinlock?) to protect the 'reset' object info
> > instead of using the transaction mutex.
> >
> > I haven't given it much thought yet and will likely not
> > investigate further for the next two weeks.
>
>
next prev parent reply other threads:[~2025-12-22 9:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-20 0:58 [syzbot] [netfilter?] possible deadlock in nf_tables_dumpreset_obj syzbot
2025-12-21 23:16 ` Florian Westphal
2025-12-22 9:21 ` Pablo Neira Ayuso
2025-12-22 9:30 ` Pablo Neira Ayuso [this message]
2025-12-22 11:16 ` Florian Westphal
2025-12-23 12:32 ` Jozsef Kadlecsik
2025-12-23 13:14 ` Florian Westphal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aUkPz0extqKuB7Bl@chamomile \
--to=pablo@netfilter.org \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=fw@strlen.de \
--cc=horms@kernel.org \
--cc=kadlec@netfilter.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=phil@nwl.cc \
--cc=syzbot+ff16b505ec9152e5f448@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.