๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #4702

Re: [PATCH net-next 07/15] netfilter: nf_tables: switch chain_types array to rcu

#4702
From: netdev-bot+sashiko
Date: Mon, 19 Oct 2026 01:21
53 lines
7590 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] Commit "netfilter: nf_tables: switch chain_types array to rcu"
  fixes a module-memory use-after-free but has no Fixes: tag and no Cc:โ€ฆ

--

netfilter: nf_tables: switch chain_types array to rcu

This converts the global chain_type array in nf_tables_api.c to RCU and
takes the module reference on the chain type owner inside the RCU read
section. That closes a window where a transaction could dereference an
nft_chain_type freed by a concurrent rmmod of nft_chain_nat, and
nft_chain_nat_exit() now calls synchronize_rcu() after unregistering.

> Reported-by: Vega <vega@nebusec.ai>
> Signed-off-by: Florian Westphal <fw@strlen.de>
> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

[Severity: Low]
Should this patch carry a Fixes: tag?

Before this patch, two lookups happened before try_module_get(type->owner),
with only the pernet commit_mutex held:

  - __nf_tables_chain_type_lookup() dereferenced t->name
  - nft_chain_parse_hook() read type->hook_mask and type->type

At the same time, nft_unregister_chain_type() cleared the slot under
nfnl_lock(NFNL_SUBSYS_NFTABLES) only.

The window seems to have been opened by commit f102d66b335a ("netfilter:
nf_tables: use dedicated mutex to guard transactions"). That commit moved
nfnl_unlock() ahead of the batch message loop in nfnetlink_rcv_batch().
It kept the nfnl mutex for chain type (un)registration.

Would this trailer be appropriate?

Fixes: f102d66b335a ("netfilter: nf_tables: use dedicated mutex to guard transactions")

Without it, stable trees that carry f102d66b335a may not pick up this fix.
Other patches in the same series do have Fixes: tags, for example
"netfilter: conntrack: fix unlikely UaF in gc worker" (also an LLM finding
from the same reporter) and "netfilter: nft_compat: restrict raw table
targets/matches".

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261018005638.1776148-2-pablo%40netfilter.org
Technical Details
Message-ID: <179237288492.3135.4070411587398264435@kernel.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-348230-linux-kernel-netdev=dewy.ru
References: <20261018005638.1776148-8-pablo@netfilter.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-348230-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next 07/15] netfilter: nf_tables: switch chain_types
 array to rcu
Date: Mon, 19 Oct 2026 01:21:24 +0000
Organization: Usenet Network
Message-ID: <179237288492.3135.4070411587398264435@kernel.org>
References: <20261018005638.1776148-8-pablo@netfilter.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3476823"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:SXFVn0oemlpyBxRtL9p57JD2MVo= sha256:o7azOudO1jBm2V1PiLbnnZqh2gww1zmQQftFmOiaM3s=
	sha1:5/8Xl5D8Sxg0ioVr3LiyqysTWDU= sha256:T3e0XGytP6vYV1a86z587cKB9VeasL79pm+LcadXTtY=
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 E9A131108DC; Mon, 19 Oct 2026 04:25:26 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.74
X-Spam-Status: No, score=-3.74 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.34, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
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 cwVVqOh-i5vX;
	Mon, 19 Oct 2026 04:25:24 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-348230-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id E02721108D5; Mon, 19 Oct 2026 04:25:15 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
	by sea.lore.kernel.org (Postfix) with ESMTP id 03E9925DD5; Mon, 19 Oct 2026 01:21:33 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 11A5733D6F7;
	Mon, 19 Oct 2026 01:21:32 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gAqGANY5"
X-Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id E3F07331EC2;
	Mon, 19 Oct 2026 01:21:25 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1792372892; cv=none; b=lMZcbigfWf2772hkfhQdWNtqMgwSIq2F2wlRkW7gEOXiy38D/EFa+b9DVDa7CrR0qamkiyPfYCLmOT2iix3rpLw2V5NhLGBo48kLJkPwcbiAENs0rmQvKrVnobOURX1UZAIR1Rl/QoVgADvtOgpTmtskpinKTpBKVbMSBor+/rA=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1792372892; c=relaxed/simple;
	bh=Bx8upF6au11sO8EHH51XNaoELRgd+b6/GvlCGOXyngo=;
	h=Subject:From:To:Cc:Date:Message-ID:In-Reply-To:References:
	 Content-Type:MIME-Version; b=XAbYxfQ5+xOHzPV4VMd/V2Vd/kFw7Govw+380rdMqBQlF44m0nAgAYSPwzn+xI8vgoL/uW25/ATWkTLBkre1MesLk+NzIy6OLHOx5FWbcnsOa8cX1ZkjPzwK5dCoZIxknwCkFFFN4qjBcJGJrghZKE1BIz5kanAesx9zH6akNlU=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gAqGANY5; arc=none smtp.client-ip=100.103.45.18
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 547F81F000C6;
	Mon, 19 Oct 2026 01:21:25 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1792372885;
	bh=/LSGs6M3uPrXkM/bJqRfMZmWfu0ucMnHmAXGUpocZZY=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=gAqGANY5bk/C2sHWboO1z0WYMdFV0UcH/gVAOrkjOOwRP90EjZuBY2fJ+m4giPWyX
	 94g5aQIT3T7eyTEjbO4B+g6ZjCTtlc8YrxIAGfotAIfey9IWfya1YabEUghzX5vRzB
	 /xJOjPqSb0zhWZnKse5DBtVh1Qp3y0Gj7dG3DgCLXBIVgmHDFjGjEP5bkWPj5T83hK
	 u+QI+Q69l/OmahEznOhfcEw1hi2pYjUzlYeWQUBaff10ryI7I/CqTyRf6nrQ4bOfBw
	 wkmZ75DZH4ARQMkQaNi8451K7j9EDBcXtIJx+4fNqN+uWPBZ4YjleFlZ+BtJTumqs/
	 7IYDdIyUyD7Hw==
X-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
X-In-Reply-To: <20261018005638.1776148-8-pablo@netfilter.org>
X-sashiko-severity: Low
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>