From: Greg KH <gregkh@linuxfoundation.org>
To: onLeaf <onleaf322@gmail.com>
Cc: pablo@netfilter.org, fw@strlen.de, phil@nwl.cc,
kadlec@netfilter.org, davem@davemloft.net, edumazet@kernel.org,
kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH net] netfilter: ipset: exclude add-path GC during resize
Date: Tue, 17 Nov 2026 10:57:38 +0100 [thread overview]
Message-ID: <2026111728-deduct-chastise-eac8@gregkh> (raw)
In-Reply-To: <20261117092731.14656-1-onleaf322@gmail.com>
On Tue, Nov 17, 2026 at 06:27:31PM +0900, onLeaf wrote:
> mtype_resize() copies elements to the new table including their extension
> pointers. Garbage collection of an expired element in the old table after
> the copy therefore frees an extension still referenced by the new table.
>
> Commit cffcf57bf03c ("netfilter: ipset: exclude gc when resize is in
> progress") prevents the delayed-work collector from running during resize.
> However, mtype_add() also invokes mtype_gc_do() directly when its target
> region is full. The packet path can enter this call while a userspace
> resize is copying the old table. It then frees the old copy's comment, and
> collection of the published copy queues the same object for freeing again.
>
> An unprivileged process can reach packet-side ipset add with CAP_NET_ADMIN
> in newly created user and network namespaces. The resulting duplicate free
> was reproduced with KASAN on x86-64 and exploited from UID 1000 to UID 0 in
> the initial user namespace on a non-KASAN build.
>
> Serialize the direct collector with the same GC lock and honor the pinned
> table's resizing flag, just as the delayed-work collector does. The table
> remains pinned by uref while the lock is held.
>
> The issue was found through AI-assisted source review. On the fixed kernel,
> the same copy/old-GC/publish/new-GC ordering completed without producing a
> duplicate object; /etc/passwd remained unchanged and the test ended in
> LPE_FAIL.
>
> This change was prepared with assistance from OpenAI Codex.
>
> Fixes: f66ee0410b1c ("netfilter: ipset: Fix "INFO: rcu detected stall in hash_xxx" reports")
> Cc: stable@vger.kernel.org
> Signed-off-by: onLeaf <onleaf322@gmail.com>
Real name please.
prev parent reply other threads:[~2026-11-17 9:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 9:27 onLeaf
2026-11-17 9:57 ` Greg KH [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=2026111728-deduct-chastise-eac8@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--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=onleaf322@gmail.com \
--cc=pabeni@redhat.com \
--cc=pablo@netfilter.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®