From: Xuanqiang Luo <xuanqiang.luo@linux.dev>
To: Ma Xinmeng <1564938642@qq.com>
Cc: netfilter-devel@vger.kernel.org, netdev@vger.kernel.org,
Phil Sutter <phil@nwl.cc>,
Pablo Neira Ayuso <pablo@netfilter.org>,
Florian Westphal <fw@strlen.de>
Subject: Re: [PATCH nf v2 0/2] netfilter: nf_tables: only disable tables on a dormant transition
Date: Wed, 18 Nov 2026 19:08:19 +0900 [thread overview]
Message-ID: <10f12bd4-6b0b-4e94-8228-04d73a62daf0@linux.dev> (raw)
In-Reply-To: <tencent_80CDC0280E0D4030AF01A16E583E88E7970A@qq.com>
On 2026/11/18 at 1:14 Ma Xinmeng wrote:
> Hi,
>
> This is v2 of the fix for the nftables WARN below. v1 was sent as
> [PATCH net] and tracked a per-basechain "registered" flag. Xuanqiang
> suggested fixing the commit condition instead: a dormant table never has
> a registered basechain hook, and nf_tables_commit() should not call
> nf_tables_table_disable() for a table that is already dormant.
>
> v2 drops the new field and changes only the NEWTABLE commit path:
>
> - if (table->flags & NFT_TABLE_F_DORMANT)
> + if (table->flags & __NFT_TABLE_F_WAS_AWAKEN)
> nf_tables_table_disable(net, table);
>
> __NFT_TABLE_F_WAS_AWAKEN records a real awake-to-dormant transition.
> Since table adoption added __NFT_TABLE_F_WAS_ORPHAN, __NFT_TABLE_F_UPDATE
> can be set for an adoption that leaves the table dormant, so the old
> check disabled the table and unregistered a hook that was never
> registered.
>
> 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 baseline 7.4-rc3 dmesg is:
>
> hook not found, pf 2 num 3
> WARNING: net/netfilter/core.c:522 at __nf_unregister_net_hook+0x71/0x1b0
> Call Trace:
> nft_table_disable+0x78/0xa0
> nf_tables_commit+0x1c03/0x1ec0
> nfnetlink_rcv_batch+0x939/0xaf0
>
> v2 was tested on 7.4.0-rc3-c027fixv2: the PoC returns 0 and dmesg has no
> WARN. I also checked a real awake-to-dormant transition: after the table
> became dormant, a ping left the basechain counter at 0, so the hook was
> still unregistered correctly.
>
> Changes in v2:
> - remove the per-basechain registered field
> - check __NFT_TABLE_F_WAS_AWAKEN instead of NFT_TABLE_F_DORMANT
> - add Fixes: 31bf508be656 ("netfilter: nf_tables: Implement table adoption support")
> - use [PATCH nf] as requested
> - add a selftest as 2/2
>
It would be nice to add a link to v1 here.
> The selftest uses the nft owner/persist table flags to create the
> dormant orphan, and checks the kernel taint state rather than parsing
> dmesg. It fails on unpatched 7.4-rc3 and passes on v2.
>
> Thanks,
> Ma Xinmeng
>
> Ma Xinmeng (2):
> netfilter: nf_tables: only disable tables on a dormant transition
> selftests: netfilter: test re-owning an already dormant table
>
> net/netfilter/nf_tables_api.c | 2 +-
> .../testing/selftests/net/netfilter/Makefile | 1 +
> .../net/netfilter/nft_table_dormant_adopt.sh | 57 +++++++++++++++++++
> 3 files changed, 59 insertions(+), 1 deletion(-)
> create mode 100755 tools/testing/selftests/net/netfilter/nft_table_dormant_adopt.sh
>
prev parent reply other threads:[~2026-11-18 10:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 16:14 [PATCH nf v2 0/2] netfilter: nf_tables: only disable tables on a dormant transition Ma Xinmeng
2026-11-18 10:08 ` Xuanqiang Luo [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=10f12bd4-6b0b-4e94-8228-04d73a62daf0@linux.dev \
--to=xuanqiang.luo@linux.dev \
--cc=1564938642@qq.com \
--cc=fw@strlen.de \
--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 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.