🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #18436

Re: [PATCH nf v2 0/2] netfilter: nf_tables: only disable tables on a dormant transition

#18436
From: 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
> 
Technical Details
Message-ID: <10f12bd4-6b0b-4e94-8228-04d73a62daf0@linux.dev>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366028-linux-kernel-netdev=dewy.ru
References: <tencent_80CDC0280E0D4030AF01A16E583E88E7970A@qq.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366028-linux-kernel-netdev=dewy.ru
From: xuanqiang.luo@linux.dev (Xuanqiang Luo)
Newsgroups: linux.kernel.netdev
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
Organization: Usenet Network
Message-ID: <10f12bd4-6b0b-4e94-8228-04d73a62daf0@linux.dev>
References: <tencent_80CDC0280E0D4030AF01A16E583E88E7970A@qq.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="2563906"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:DQLANwwHvdpCC7J9M48Zfu4ZOqo= sha256:Qt6FKSagG2B44kl7xvxq2Znv7suwjGsgsmN/ulaeJQ8=
	sha1:pG0CtRKRdddjRDsaBPrBi/cEBsE= sha256:mEsPERdwcwoOGmREE44e9BTPH36nSIzvNmceErZwA+E=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 25F84115240; Wed, 18 Nov 2026 13:08:50 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.05
X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key)
	header.d=linux.dev
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id iTsYX5M1hY4x;
	Wed, 18 Nov 2026 13:08:46 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-366028-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=linux.dev
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id 08A9A11523A; Wed, 18 Nov 2026 13:08:37 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id E645434C7C; Wed, 18 Nov 2026 10:08:31 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794996510;
	b=Ivrv/9IEiq+vmo26N1bKlcw1sFikyMgWPSgDrPU1DgU1H+CukyaSJToeP0LDwcX3K82a
	 +WEoYL0SqAHjeom5xuxqOkARTh4Y8mKCJ1QlkxabnndL+/xtR3DcWXw9Ga5NbH9rxLBiq
	 gKqW5xFnsL9YhAR6eVNJWeH2Nh0PRCMW6IpVv1fHMBhgXuBoWMt774klKuv/IsIJef6yd
	 2TGvj6HoJ1MqkBYJjLdBjzUhbEfl6G3OSZ800apaLeKQntNmbuUrDn6dfxBlx4Yzf0i4Y
	 BIRBGj7iS+RsQIA6CfOt6T9MlNc8GuhAjgBaymC13O3C1Q4JnwtQZRFQAqbmvXRglig==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794996510;
	h=X-Original-To:Received:DMARC-Filter:X-Envelope-To:DKIM-Signature:
	 X-Envelope-To:Received:X-Mizu-Trace-ID:X-Migadu-Flow:Message-ID:Date:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:User-Agent:
	 Subject:To:Cc:References:From:In-Reply-To:Content-Type:
	 Content-Transfer-Encoding;
	bh=Qz2aEB2Nm1ekmcMD9FQ6yh0BCWvEwRLtp4myOxqi53s=;
	b=1sLcaGLP3lnGzseAbUSubpsqbL1lG8wQlmH89cGwFh9IVfxNm2F41T3AObAVZMK+A3Ep
	 Lf2FxCFcK+GS3o6sVyGTXylIE9g7M/wU+MxWxqL8gVMEcdOLtADI24AqhWuKjX2AX9dyV
	 YS4t+2Sw8p1Mj6nds3nQjuXx3OJnk1U3rHzwongxHj/xIBquDXhJ6ZjtjzoBf4wMHkMbL
	 WFGVvi2klQAiSVfsJpwBYlJ2SUj7tSJhy1fhzgydflEXhoO3yIHb4ofizIHJmrr38Jvby
	 azsE795zscA3xH8VsGKTeOMAcXyuuw1BCyolO3+Q+EjhhTk0fv5gTzhL4vvByW3I1Dw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=pvWn780c;
	dmarc=pass header.from=linux.dev;
	spf=pass smtp.mailfrom=linux.dev;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id EDC28606A33B;
	Wed, 18 Nov 2026 10:08:29 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=pvWn780c
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.33
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794996509;
	b=MAsw2bu48Z0u0w9z6OiJqirXY112mi8qsmXL6/BuxELeX1dgaLyBkepoPbv4Imw8qJRa
	 oIDhqQiF46CG1eWXziFDmdIhS88hs8H+SoHytzjA0H3v4ZdHW9weZ/sQcRjtllXIzUjEh
	 xns3fLBwHS0mUkHVP/Ip0jsYpmKABlAkE5XhsZIZebNq7uND9GBYWPzazebNZ1DPPsKOu
	 AfzZQ++dOznFmSqTty56r4ZqUutq3ljUq3oSZ9M/HjViJpU+/WCc4ZZ48Br5NNo4PYRpH
	 wuzLLilz21mcRJkmP+7QfZnqzgx5/lguRFaxZyqHIBcg4hSGwINHgiICDBZJR7Qq8XQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794996509;
	h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received:
	 X-Mizu-Trace-ID:X-Migadu-Flow:Message-ID:Date:MIME-Version:User-Agent:
	 Subject:To:Cc:References:From:In-Reply-To:Content-Type:
	 Content-Transfer-Encoding;
	bh=Qz2aEB2Nm1ekmcMD9FQ6yh0BCWvEwRLtp4myOxqi53s=;
	b=rxH9450wr1cdaPk/FyF4+vt8BhnGUbKgdnKERUzl1SdjZSCi1bUpdBtN82n47mVYy85m
	 ClG03aiuChekjntisPTJ81lCuRPF/H1GWdn0haqoQ4RDCrOyXeCb+r/rsRgqZgtxYfhGO
	 IUDex7bbfmD2pWypq9B3vV3zxwqs7YZ8gPcZgwIJ1o/5UMYb1CtBi4lsiacpvu1/UgGGN
	 FF61Sl1AUG41H0rh0SMlt1MRyt9cPFCx95flS4u5hOdH7cp9RIdG2NiEtCt1fQdgsr/Of
	 SyvQgqhGjxWzJwNwkVitE+PJdeCZ831njad5Odt1l8+uQHiYF+iVxy09zz6+R+aYYAg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=linux.dev;
	spf=pass smtp.mailfrom=linux.dev;
	dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=pvWn780c;
	arc=none smtp.remote-ip=95.215.58.33
X-Received: from mta1.migadu.com (out-33.mta1.migadu.com [95.215.58.33])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2E0B8606A325
	for <netdev@vger.kernel.org>; Wed, 18 Nov 2026 10:08:27 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2E0B8606A325
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev
X-Envelope-To: netdev@vger.kernel.org
X-DKIM-Signature: a=rsa-sha256; bh=gTWWkKNqiGiRm5q5+vRO1BZhUiAhUFJJwPIYPbRkP/0=;
 c=simple/simple; d=linux.dev;
 h=from:to:subject:date:message-id:mime-version:content-type; s=key1;
 t=1794996506; v=1; x=1795601306;
 b=pvWn780cvjz07h0JxdIkHrHAA27ZRq2+QqgnlGqPSPRyIooFg3Xi5ZYYLtM2vLo72rP+o2c3
 HbYBls0ph9N+wm9SG5hyXsris8Ks7igLmdNHikAPjhcmVSMz1Ywr9gE9MNTw/G6uoLDEYYlKmsL
 Ow/5niY1FJxFehINNkag3asE=
X-Envelope-To: netdev@vger.kernel.org
X-Received: by smtp.migadu.com with ESMTPS id 7d48908e68266c64;
	Wed, 18 Nov 2026 10:08:26 +0000
X-Mizu-Trace-ID: 7d48908e68266c64
X-Migadu-Flow: FLOW_OUT
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-User-Agent: Mozilla Thunderbird
X-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>
X-In-Reply-To: <tencent_80CDC0280E0D4030AF01A16E583E88E7970A@qq.com>