Linux Netfilter development
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org, Jeremy.Jean@oss.cyber.gouv.fr
Subject: Re: [PATCH nf] netfilter: nft_set_rbtree: narrow down range completion to anonymous sets
Date: Sat, 10 Oct 2026 10:46:59 +0200	[thread overview]
Message-ID: <asn7d2tlQpi6Zcix@strlen.de> (raw)
In-Reply-To: <asd2AaXSM9oDeich@chamomile>

Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> On Thu, Oct 08, 2026 at 12:52:35PM +0200, Pablo Neira Ayuso wrote:
> > On Thu, Oct 08, 2026 at 08:32:54AM +0200, Florian Westphal wrote:
> > > Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> > > > For anonymous sets, when adjacent ranges are found, the end element is
> > > > not added to the set to pack the set representation. Use next start
> > > > element to complete this interval.
> > > > 
> > > > Jérémy Jean says:
> > > > 
> > > > Consider two ranges in a netfilter verdict map:
> > > > * keys 10-19 accept packets, and
> > > > * keys 30-39 jump to chain 'victim'.
> > > > Now, delete the end marker at 20. The lookup array now uses element 30
> > > > as the first range's end, so an INTERVAL_END query for key 15 returns
> > > > element 30, including its jump verdict and chain pointer. This can make
> > > > KASAN reports a UAF after the GC releases reference chain for 30 that
> > > > has expired:
> > > 
> > > Dumb question: How is it possible to remove an element if the map is
> > > anonymous?
> > 
> > I suspect this is a strange combination which cannot be reached from
> > userspace.
> 
> I mean, via nft.

Even with netlink API: DELSETELEM has:

        if (nft_set_is_anonymous(set))
                return -EOPNOTSUPP;

Jérémy, can you share what your reproducer is doing to get the rbtree
map into the bad state?

Thanks!

Just to be clear: this patch is fine, but I a) wonder if there is
some other bug elsewhere, and b) if we can make a test case for
this for either nftables.git or knft so that this is covered.

      reply	other threads:[~2026-10-10  8:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-07 22:03 [PATCH nf] netfilter: nft_set_rbtree: narrow down range completion to anonymous sets Pablo Neira Ayuso
2026-10-08  6:32 ` Florian Westphal
2026-10-08 10:52   ` Pablo Neira Ayuso
2026-10-08 10:52     ` Pablo Neira Ayuso
2026-10-10  8:46       ` Florian Westphal [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=asn7d2tlQpi6Zcix@strlen.de \
    --to=fw@strlen.de \
    --cc=Jeremy.Jean@oss.cyber.gouv.fr \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox