All of lore.kernel.org
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: pablo@netfilter.org
Cc: netfilter-devel@vger.kernel.org, davem@davemloft.net,
	netdev@vger.kernel.org, kuba@kernel.org, pabeni@redhat.com,
	edumazet@kernel.org, horms@kernel.org, fw@strlen.de, ja@ssi.bg
Subject: Re: [PATCH net 01/10] netfilter: conntrack: prevent helper extension relocation
Date: Tue, 01 Dec 2026 22:45:20 +0000	[thread overview]
Message-ID: <179616512099.3146.14146314326211595367@kernel.org> (raw)
In-Reply-To: <20261130215141.1009148-2-pablo@netfilter.org>

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] The commit message describes a use-after-free path that the
  tree no longer has.

--

netfilter: conntrack: prevent helper extension relocation

When nf_ct_ext_add() adds the helper extension, it now reserves enough
room for every extension type, including alignment padding. Later
extension additions to the same unconfirmed conntrack then cannot move
the extension blob. The goal is to keep an expectation's lnode.pprev
from pointing into freed memory.

> An nftables CT expectation object can link an expectation before a later
> NAT expression adds extensions to the same unconfirmed conntrack. If an
> addition relocates the blob, the copied hlist head still points to the
> expectation, but the expectation's pprev continues to point into the
> freed old blob. Removing the expectation later executes hlist_del_rcu()
> and writes through this stale pointer.

[Severity: Medium]
Is this description still accurate for the tree this patch applies to?

The baseline already has commit 3679da4ad8be ("netfilter: nft_ct: move
custom expectation support to helper"). It carries the same Fixes: tag
(857b46027d6f) and has the same reporter.

After that commit, nft_ct_expect_obj_eval() in net/netfilter/nft_ct.c
never calls nf_ct_expect_related(). It only adds the helper extension,
stores the parameters and attaches the internal helper:

	help = nf_ct_helper_ext_add(ct, GFP_ATOMIC);
	...
	expect_data->obj = *priv;
	expect_data->obj.helper = NULL;
	expect_data->dir = CTINFO2DIR(ctinfo);

	if (help && refcount_inc_not_zero(&priv->helper->ct_refcnt))
		rcu_assign_pointer(help->helper, priv->helper);

The expectation is now linked only in ct_expect_help(), which runs as
helper->help():

	if (nf_ct_expect_related(exp, 0) != 0)
		ret = NF_ACCEPT;

Every caller of helper->help() runs it after all extensions have been
added:

- nf_confirm() calls it right before nf_ct_seq_adjust() and
  nf_conntrack_confirm().
- tcf_ct_act() in net/sched/act_ct.c calls it after the comment "This
  has to be done after all the extensions are already added".
- net/openvswitch/conntrack.c calls it after the comment "all the
  extensions must be allocated before the call".

None of these paths seem to call nf_ct_ext_add() once the expectation
is linked. So the relocation of a linked expectation's pprev described
above does not look reachable through nft_ct in this tree.

The change still looks reasonable as hardening, since it removes the
ordering rule between extension additions and helpers. On older stable
trees without 3679da4ad8be, it would also close the original bug.

However, the message describes a live use-after-free and carries
Fixes: and Cc: stable tags, but it does not mention 3679da4ad8be.
Could the message say how this patch relates to 3679da4ad8be? For
example, is it a second fix for the same bug, an alternative backport,
or hardening? That would tell stable maintainers whether they need one
of the two patches or both.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130215141.1009148-2-pablo%40netfilter.org

  parent reply	other threads:[~2026-12-01 22:45 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 21:51 [PATCH net,v2 RESEND 00/10] Netfilter fixes for net Pablo Neira Ayuso
2026-11-30 21:51 ` [PATCH net 01/10] netfilter: conntrack: prevent helper extension relocation Pablo Neira Ayuso
2026-11-30 21:54   ` netdev-bot+sinfo
2026-11-30 21:56     ` Pablo Neira Ayuso
2026-12-01 22:10   ` patchwork-bot+netdevbpf
2026-12-01 22:45   ` netdev-bot+sashiko [this message]
2026-11-30 21:51 ` [PATCH net 02/10] netfilter: xt_IDLETIMER: restrict to init_net Pablo Neira Ayuso
2026-11-30 21:51 ` [PATCH net 03/10] netfilter: synproxy: prevent unbounded recursion in transmit path Pablo Neira Ayuso
2026-11-30 21:51 ` [PATCH net 04/10] netfilter: conntrack: wait for RCU readers before freeing the hash Pablo Neira Ayuso
2026-11-30 21:51 ` [PATCH net 05/10] netfilter: nft_synproxy: only handle pure SYN and ACK packets Pablo Neira Ayuso
2026-11-30 21:51 ` [PATCH net 06/10] netfilter: conntrack: limit master chain depth Pablo Neira Ayuso
2026-12-01 22:45   ` netdev-bot+sashiko
2026-11-30 21:51 ` [PATCH net 07/10] netfilter: conntrack: skip unconfirmed entries in /proc/net/nf_conntrack Pablo Neira Ayuso
2026-11-30 21:51 ` [PATCH net 08/10] netfilter: bridge: detach conntrack template on invalid IP frames Pablo Neira Ayuso
2026-12-01 22:45   ` netdev-bot+sashiko
2026-11-30 21:51 ` [PATCH net 09/10] netfilter: synproxy: fix double tsoff application in server ACK TSecr Pablo Neira Ayuso
2026-11-30 21:51 ` [PATCH net 10/10] netfilter: nf_tables: only disable tables on a dormant transition Pablo Neira Ayuso
  -- strict thread matches above, loose matches on Subject: below --
2026-11-30 21:25 [PATCH net,v2 00/10] Netfilter fixes for net Pablo Neira Ayuso
2026-11-30 21:25 ` [PATCH net 01/10] netfilter: conntrack: prevent helper extension relocation Pablo Neira Ayuso

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=179616512099.3146.14146314326211595367@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=fw@strlen.de \
    --cc=horms@kernel.org \
    --cc=ja@ssi.bg \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --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 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.