🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
1 messages
1 total messages Started by Xuanqiang Luo Wed, 18 Nov 2026 10:08
Re: [PATCH nf v2 0/2] netfilter: nf_tables: only disable tables on a dormant transition
#18436
Author: Xuanqiang Luo
Date: Wed, 18 Nov 2026 10:08
66 lines
11034 bytes
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
> 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads