From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Aohan Mei <ljp1205831794@gmail.com>
Cc: netfilter-devel@vger.kernel.org, fw@strlen.de, phil@nwl.cc,
coreteam@netfilter.org, Aohan Mei <henrymei@tencent.com>,
TencentOS Corvus AI <corvus@tencent.com>,
stable@vger.kernel.org
Subject: Re: [PATCH nf] netfilter: nf_tables: skip expired catchall elements in dedup walk
Date: Wed, 9 Sep 2026 01:31:15 +0200 [thread overview]
Message-ID: <aqCaw5aXx4B4E2Sm@chamomile> (raw)
In-Reply-To: <aqCYmZ6_Kc0OqRcR@chamomile>
On Wed, Sep 09, 2026 at 01:22:04AM +0200, Pablo Neira Ayuso wrote:
> On Tue, Sep 08, 2026 at 08:32:47PM +0800, Aohan Mei wrote:
> > From: Aohan Mei <henrymei@tencent.com>
> >
> > nft_setelem_catchall_insert() looks up duplicates with
> > nft_set_elem_active() only, while nft_set_catchall_lookup() and the
> > dump path additionally skip expired and dead elements.
> >
> > Once a catchall element with a timeout expires, this predicate drift
> > makes it invisible to userspace dumps, yet it still blocks
> > re-insertion: with NLM_F_EXCL the request fails with -EEXIST, and
> > without it the request reports success but silently inserts nothing.
> > The stale entry only goes away when the (user-tunable) gc interval
> > elapses, so the catchall rule may silently stop matching for an
> > arbitrarily long time after its first expiration.
> >
> > Align the dedup walk with the lookup and dump predicates: only an
> > element that is active, not expired and not dead counts as a
> > duplicate.
> >
> > Reported-by: TencentOS Corvus AI <corvus@tencent.com>
> > Cc: stable@vger.kernel.org
> > Fixes: aaa31047a6d2 ("netfilter: nftables: add catch-all set element support")
> > Assisted-by: CodeBuddy:Kimi-K3
> > Signed-off-by: Aohan Mei <henrymei@tencent.com>
> > ---
> > net/netfilter/nf_tables_api.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
> > index 765a92fa90d6..6458ee26dcd9 100644
> > --- a/net/netfilter/nf_tables_api.c
> > +++ b/net/netfilter/nf_tables_api.c
> > @@ -6995,7 +6995,9 @@ static int nft_setelem_catchall_insert(const struct net *net,
> >
> > list_for_each_entry(catchall, &set->catchall_list, list) {
> > ext = nft_set_elem_ext(set, catchall->elem);
> > - if (nft_set_elem_active(ext, genmask)) {
> > + if (nft_set_elem_active(ext, genmask) &&
> > + !nft_set_elem_expired(ext) &&
>
> This should be:
> __nft_set_elem_expired(ext, tstamp)
Delete also need this this expired check.
> > + !nft_set_elem_is_dead(ext)) {
>
> I don't think dead flag is set on for catchall elements?
It does indeed use it, but I think this check does not belong here and
the check for expired is sufficient.
> > *priv = catchall->elem;
> > return -EEXIST;
> > }
> > --
> > 2.43.7
> >
> >
prev parent reply other threads:[~2026-09-08 23:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 12:32 [PATCH nf] netfilter: nf_tables: skip expired catchall elements in dedup walk Aohan Mei
2026-09-08 23:22 ` Pablo Neira Ayuso
2026-09-08 23:31 ` Pablo Neira Ayuso [this message]
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=aqCaw5aXx4B4E2Sm@chamomile \
--to=pablo@netfilter.org \
--cc=coreteam@netfilter.org \
--cc=corvus@tencent.com \
--cc=fw@strlen.de \
--cc=henrymei@tencent.com \
--cc=ljp1205831794@gmail.com \
--cc=netfilter-devel@vger.kernel.org \
--cc=phil@nwl.cc \
--cc=stable@vger.kernel.org \
/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.