Netdev List
 help / color / mirror / Atom feed
From: Ma Xinmeng <1564938642@qq.com>
To: Pablo Neira Ayuso <pablo@netfilter.org>, Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org, netdev@vger.kernel.org,
	Phil Sutter <phil@nwl.cc>,
	Xuanqiang Luo <luoxuanqiang@kylinos.cn>
Subject: [PATCH nf v3 0/1] netfilter: nf_tables: only disable tables on a dormant transition
Date: Tue, 24 Nov 2026 15:33:11 +0800	[thread overview]
Message-ID: <tencent_0D3F10E667CD8029160DC031D700756D480A@qq.com> (raw)

Hi,

This is v3 of the fix. v2 included a selftest in the kernel tree; review
asked to move it to nftables.git as a shell test under
tests/shell/testcases/transactions/, where run-tests.sh already handles
the tainted-kernel check. v3 keeps only the one-line kernel fix; the test
is sent separately as [PATCH nft] (0052dormant_table_adopt_0).

The problem is unchanged. A dormant table has no registered basechain
hooks. Re-owning an already dormant PERSIST orphan sets
__NFT_TABLE_F_UPDATE because of the adoption, and nf_tables_commit()
used to call nf_tables_table_disable() for it. That cleared DORMANT,
walked the chains, and unregistered a hook that was never registered,
triggering WARN_ONCE("hook not found") in __nf_unregister_net_hook().

v3 only changes the NEWTABLE commit path to check
__NFT_TABLE_F_WAS_AWAKEN, which records a real awake-to-dormant
transition:

- if (table->flags & NFT_TABLE_F_DORMANT)
+ if (table->flags & __NFT_TABLE_F_WAS_AWAKEN)
      nf_tables_table_disable(net, table);

The WARN was found by FuzzAnything's AI-assisted kernel fuzzer while
fuzzing nftables netlink messages in a user and network namespace, and
I reproduced it at runtime on 7.3.0-rc4, 7.3.1, 7.4-rc1, 7.4-rc2, and
7.4-rc3. The v2 code was A/B tested on 7.4.0-rc3: baseline WARN, patched
no WARN, and a real awake-to-dormant transition still disables the hook.

Changes in v3:
- drop the kernel selftest; no change to the one-line fix
- move the test to nftables.git as a separate [PATCH nft]
- keep Fixes: 31bf508be656 ("netfilter: nf_tables: Implement table adoption support")

Link: https://lore.kernel.org/all/tencent_19A48DA487BBFCFD990AC5A8010C663EA007@qq.com/

Thanks,
Ma Xinmeng

Ma Xinmeng (1):
  netfilter: nf_tables: only disable tables on a dormant transition

 net/netfilter/nf_tables_api.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.56.0.windows.4.niugit


                 reply	other threads:[~2026-11-24  7:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=tencent_0D3F10E667CD8029160DC031D700756D480A@qq.com \
    --to=1564938642@qq.com \
    --cc=fw@strlen.de \
    --cc=luoxuanqiang@kylinos.cn \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=phil@nwl.cc \
    /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