All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: netfilter-devel@vger.kernel.org
Cc: kadlec@netfilter.org
Subject: Re: [PATCH nf 0/5] netfilter: ipset fixes and rhastable prep work
Date: Thu, 30 Jul 2026 21:55:50 +0200	[thread overview]
Message-ID: <amusRhSn19YQzmQe@strlen.de> (raw)
In-Reply-To: <20260730183853.21868-1-fw@strlen.de>

Florian Westphal <fw@strlen.de> wrote:
> This series contains a few fixes and prepation work for the
> ipset rhashtable conversion.  The rhashtable conversion patch set is
> too large to post in one pile and has one external dependency that is not
> yet in nf (queued in crypto tree).
> 
> I discussed this with Jozsef and we think that targeting the rhashtable
> conversion to nf tree is preferrable to nf-next due to the volume of LLM
> reports.
> 
> 1) Rework ipset CIDR bookkeeping with an RCU-based method to ensure
> safety on weakly-ordered architectures. Replace in-place updates with
> structure replacement. From Jozsef Kadlecsik.

1 & 2 two trigger sashiko reports, but I ask that those are ignored:
https://sashiko.dev/#/patchset/20260730183853.21868-1-fw%40strlen.de

'Is it safe to modify h->rnets[i] and call kfree_rcu() here without holding
set->lock?'

No.  This is resolved in the rhashtable conversion, which introduces
synchronization between delete and flush: only one thread can detach the
element from the rhashtable, those observing the -ENOENT will skip the
element.

>  #ifdef IP_SET_HASH_WITH_NETS
>  	for (i = 0; i < IPSET_NET_COUNT; i++)
> -		mtype_add_cidr(set, h, NCIDR_PUT(DCIDR_GET(d->cidr, i)), i);
> +		mtype_add_cidr(set, h, DCIDR_GET(d->cidr, i), i);

'Does this code correctly handle memory allocation failures?'

No.  I added this handling in the rhashtable conversion, as that has to
rewrite most of that function anyway.

> 2) Switch ext_size to atomic64_t in ipset to prevent races during parallel
> updates.  Also from Jozsef.

'This isn't a bug introduced by this patch, but can a race condition during hash
table resizing and concurrent element updates lead to a double free of comment
extensions here?'

Yes, this is also resolved when converting to rhashtable, the resize
callback is removed.

'This is a pre-existing issue, but does asynchronous element destruction in
list_set_flush() race with this synchronous zeroing of set->ext_size, causing
an integer underflow?

If a user flushes a list:set ipset, list_set_flush() forces the counter to 0
here. The elements are queued for asynchronous deletion via call_rcu() inside
list_set_del().'

I will have another look at this to see if thats correct, in any case
this should be handled in a different change.

      parent reply	other threads:[~2026-07-30 19:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-30 18:38 [PATCH nf 0/5] netfilter: ipset fixes and rhastable prep work Florian Westphal
2026-07-30 18:38 ` [PATCH nf 1/5] netfilter: ipset: rework cidr bookkeeping Florian Westphal
2026-07-30 18:38 ` [PATCH nf 2/5] netfilter: ipset: switch ext_size to atomic64_t Florian Westphal
2026-07-30 18:38 ` [PATCH nf 3/5] netfilter: ipset: add small wrappers for hash and bucket sizes Florian Westphal
2026-07-30 18:38 ` [PATCH nf 4/5] netfilter: ipset: add and use mtype_del_cidr_all helper Florian Westphal
2026-07-30 18:38 ` [PATCH nf 5/5] netfilter: ipset: switch to rcu work Florian Westphal
2026-07-30 19:55 ` 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=amusRhSn19YQzmQe@strlen.de \
    --to=fw@strlen.de \
    --cc=kadlec@netfilter.org \
    --cc=netfilter-devel@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.