🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #25104

[PATCH net] netfilter: conntrack: serialize helper extension allocation

#25104
From: zhuorao yang
Date: Tue, 01 Dec 2026 08:58
59 lines
12947 bytes
Two CPUs can add the helper extension to the same unconfirmed conntrack
when shared skbs are evaluated concurrently.  nf_ct_ext_add() then calls
krealloc() on the same ct->ext from both CPUs.  If the first call moves
the extension allocation, the second call can double-free the old one.

Serialize nf_ct_helper_ext_add() with the conntrack lock.  The lock also
covers publishing IPS_HELPER_BIT and initializing the expectation list,
so a concurrent caller observes a fully initialized helper extension.

Fixes: 1a64edf54f55 ("netfilter: nft_ct: add helper set support")
Signed-off-by: zhuorao yang <alex000young@gmail.com>
---

Vulnerability report

Affected versions: Linux 7.4.0-rc5 at
  fe6ff8d5d675c01793b9f051d16055dd4aa75244; the helper-set path dates to
  v4.12.
Trigger conditions: CONFIG_NFT_CT and CAP_NET_ADMIN in the target
  network namespace. Two skbs must share the same unconfirmed conntrack
  and execute nft_ct_helper_obj_eval() concurrently on different CPUs.
  Existing accounting, timestamp, event-cache, or label extensions make
  the helper extension enlarge and relocate ct->ext.
Reproducer status: A QEMU KASAN harness forced two CPUs to enter
  nf_ct_helper_ext_add() on the same unconfirmed conntrack with a
  104-byte extension allocation. The unpatched kernel produced a double-
  free in krealloc_node_align_noprof. With the fix, 1000 synchronized
  two-CPU iterations completed without KASAN. The exact shared-skbs
  network path has not yet been shown without the test harness.
Reproducer material is intentionally withheld from this public message.

AI assistance: DeepSeek identified the issue and drafted the patch.
The submitter reviewed the code and certified the Developer Certificate
of Origin.

 net/netfilter/nf_conntrack_helper.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/netfilter/nf_conntrack_helper.c b/net/netfilter/nf_conntrack_helper.c
index c30ae3f203be..4d2dd88e74f3 100644
--- a/net/netfilter/nf_conntrack_helper.c
+++ b/net/netfilter/nf_conntrack_helper.c
@@ -184,11 +184,13 @@ nf_ct_helper_ext_add(struct nf_conn *ct, gfp_t gfp)
 {
 	struct nf_conn_help *help;
 
+	spin_lock_bh(&ct->lock);
 	help = nf_ct_ext_add(ct, NF_CT_EXT_HELPER, gfp);
 	if (help) {
 		__set_bit(IPS_HELPER_BIT, &ct->status);
 		INIT_HLIST_HEAD(&help->expectations);
 	}
+	spin_unlock_bh(&ct->lock);
 	return help;
 }
 EXPORT_SYMBOL_GPL(nf_ct_helper_ext_add);
-- 
2.56.0
Technical Details
Message-ID: <20261201085814.82573-1-alex000young@gmail.com>
Path: mbox-mo1.pugleaf.net!news-fra.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-374873-linux-kernel-netdev=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-fra.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-374873-linux-kernel-netdev=dewy.ru
From: alex000young@gmail.com (zhuorao yang)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net] netfilter: conntrack: serialize helper extension allocation
Date: Tue,  1 Dec 2026 16:58:14 +0800
Organization: Usenet Network
Message-ID: <20261201085814.82573-1-alex000young@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1667787"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:jb3W4izRFHRlhKUHvh8LXuzJEpA= sha256:MdldkQYGNkJc/uWcGJp6EqHTAs0IjAaBZGsV5BPJlNc=
	sha1:KJFGVFQri2Z5/JcNARHBcYrk5QI= sha256:sxcD2LYseuCcNS+pMJuDHUkU1JLB3u8qpwh3o4S9Pz0=
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 E33631172E6; Tue,  1 Dec 2026 12:02:40 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 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, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, 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] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=gmail.com
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 umkx-hBo5FEg;
	Tue,  1 Dec 2026 12:02:38 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-374873-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id A12E11172DB; Tue,  1 Dec 2026 12:02:29 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 6044830AB0; Tue,  1 Dec 2026 09:02:26 +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=1796115746;
	b=uH8uPc9maPgUDnB8H9SOEGaq8OtJ8zfQD6VqAdOtLMX2KstjKVp+Rp0we8RVMWR579ev
	 J3D+HvLbkizwbhG0Naz9vfVfJnohyGvzuJlXkeElVrEiIMUBfbcQMQQL5ND9js5IiZr8T
	 K2ACGksWB64pY43M261h0PyzraX0D15uZCpMb5Sg/m8I4DtwBXNebVwtbUxqd++N7xNkB
	 6Jk/PRhuJ9+oMzcza3es49BAFWPW0s/a711leRcqB45qiwlXY8bZTrgWyOP16Oh17JXqn
	 wjOVUUAXoAmeGWKRWncoZJpy8W2YHpsSimzcCtj/UjPQ2s6XcPCdZH41DxaBSMPOFQg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796115746;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
	 X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:Date:Message-ID:
	 X-Mailer:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Transfer-Encoding;
	bh=sL37OI+fW7/naMTi+7AppvVUyo6nvx9cHdphRMAiohQ=;
	b=JUHHbgl5TI4gq4ISm6SAfWA57krbY0u86XRwYxKxkiQkJGga5Jr60VN2SsmnI12Fm5Bz
	 mQFXVNwoTLkjkmx2ppLCrjhyiVRfN47vyo6sDWX/iMXqSrvjZqR0kkTpd/fwVE5Ip/Mm4
	 elSOqay8xzf80T+X/DtMil9IcjlcP7pKqIudkRTrc3PYjEBJMI3hqiKHQsCybdLWdhxJO
	 DZTn2WwtKWmRrVNVCVEDhhfeGEloAubW76WOMooNLknk8D/4jj3Q4b+rwCqjR2ZcsoQNW
	 itd57PTsjS/VWu+bBQSlEcJ8VdMm0QpxOCFDkgf7gJ8jA2doULGtsYTCCp87qkZ78pw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b="k/9y+p4A";
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	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 E8CED606A32E;
	Tue,  1 Dec 2026 09:02:25 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=k/9y+p4A
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.179
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796115745;
	b=LzucmK3cuomrxbtaqnxLvbCnNavtV4206qgzlUjrxHiCgbHXJRKc+PhNI8I8JKgdzwQA
	 atfiQIcfrIEATOoSGN4ODp418XMo/OWygqliEtLIlasrs4Evb+t/9ZuFzZnXtKPTKnQb7
	 n/noXYluXh0eENE881TZmsGli2JD+XCDRPdI55eZQRrmirmQdEebM7j+aVfmw3AWdGuez
	 9xme70FWzc+4CGL9RmMRDI0ApYkwQ3UXe+30KCq325SwryUJfgfYoNBjMvV7b/0AAMYYD
	 OEcEo+hAdRFUlAwXhtJgVMGAZ+PInZTVGsbQPRVBC7oaLQmFEEWSDvvSHICiamks8Rg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796115745;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
	 From:To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version:
	 Content-Transfer-Encoding;
	bh=sL37OI+fW7/naMTi+7AppvVUyo6nvx9cHdphRMAiohQ=;
	b=f99wKBof8bSeBZ740lz89TIIJ8HZf2tQ4VWps93HE4WzTpqerBIQFfYS4QPOOudbLY7k
	 /+d1Pa8bISvXOcb4mMpNmNn+sU66uBr18KhIqQff7KikPaWCMCTilqbaI2iB34QSHye3n
	 JtzKOEaEOoLy3lxgcb8RznG4gi27PjPJVGJ4UNb2Yrk5gqlNbfSnkzvNPgYJRJGo8RTZf
	 NighSJbgN0HaUL/ZXB4Zfzow8ljVR0rNUVLliROajCTrhRyYa0wzABJzGuGkkbKsz1+oL
	 l7jSJLE90Ej9EH2XpbET9LmqRfL2/pKAHC8J+0MQBxgC1aultgIEyYL8MvAqIRUUACQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b="k/9y+p4A";
	arc=none smtp.remote-ip=209.85.210.179
X-Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179])
	(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 B88E0606A31A
	for <netdev@vger.kernel.org>; Tue,  1 Dec 2026 09:02:24 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B88E0606A31A
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-8a4c72951b8so7282846b3a.3
        for <netdev@vger.kernel.org>; Tue, 01 Dec 2026 01:02:24 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1796115744; x=1796720544; darn=vger.kernel.org;
        h=content-transfer-encoding:mime-version:message-id:date:subject:cc
         :to:from:from:to:cc:subject:date:message-id:reply-to:content-type;
        bh=sL37OI+fW7/naMTi+7AppvVUyo6nvx9cHdphRMAiohQ=;
        b=k/9y+p4Am2XNh4NnGJVfT7/uFubpBSJDe+IBEf3MPTSYBFzFa+X4MG92TOKOhdU2Yo
         s06AqHxxr8fdWau9mqcCQPOMCbt+6XsDQULIwVqkqV9Iyx1IFF4YJYhf1LMj8OKoQnW4
         Hvg5Zj6DDAVMyWOZEkaMU8h7TYP9dSPrjkqDTIvSbUgvc5tyKX1rsbI2ag/DQrmNAE2Q
         hz066ubKxmC60QPKGlHQvnEXLTczHpjWWl0UqBAv6paoiXUNk7UkNzlckhJ90GYXAL1G
         w8VBmKvtw8KwublcTQQl2KHK6UEfvlBMGqQLLQbMjoot44BsZoZ0vGkuDOu6aEWXXO8q
         cPmg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1796115744; x=1796720544;
        h=content-transfer-encoding:mime-version:message-id:date:subject:cc
         :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=sL37OI+fW7/naMTi+7AppvVUyo6nvx9cHdphRMAiohQ=;
        b=mIHVzaVAFEbLR/lx869Lqp5w53bq9jFYHq1pWrsV4KQEXc1uJgu0OXDMu21iFSPm/k
         GRXmyZo0cVhks6/yyeueTA9hTAespIjVVXQgp2aalHJyRhM8DRv00spQnq/brD2NbONY
         oihzaXOnp4hs9MmNJvS1i9U7K1yezHer4J167irn/dn1FpPgbGtR+3q4uCtu5N0uhWVb
         +IP2MikEFvdhH5zu+tX2Ooe5lhuTiKCuIeZu14r3QKkJGFSzSnMJRwJ+hcEACHcWeEgb
         z2JEGV3H97+v+xAZ/cekUc0humQdEegIMTJtxpMa8eIqYHRzIPJw9cV8d5kCx7c6Q5YL
         Wo2A==
X-Forwarded-Encrypted: i=1; AL+hErHIPPlqpAVhAz/1loDTIpBKDkAbHrgA0YpV0KrAfrqzmdheEE1WeHcNueLbBVK96l+N+A1KeXo=@vger.kernel.org
X-Gm-Message-State: APuU4Z+DmiY201rNgs9iMlaqK5GS8rWtcp73YDhe4/JVhaJ5fJyyko5y
	7bvtJGwi4iO4xzuptFbTf/OT6cS2lxuy+YewOahdHBJrmHeiDakzi6Iv
X-Gm-Gg: AZFdTZc7GS/ODO8Z67H8rz5xWorWXFPlvEBfDJ02pWVobKBnpVjB/JfehzWcW0iqVS7
	yDV8OALXiz0PKmescYQK4xjmwGCLyKssv7y4G/fdjIeVZFFCV5tQkjSSHm4kaCGd4oOYW5iUDYK
	sG9KqvZ30qcpRrp9Dc5K+XntHGoZILMh3qOB9Dh7YrH6bSgVd1wkO4fGWK/mnbmK/+/ayjBD2at
	7r3CWo1SCGgBHZemYr3gf2g10/tb0L1jyqHp2L/IIFwxCQvwJwKoAftOgA8zhk3LRgs9rGEYk/V
	nCijT7fNZAQQjXuywdb2W//0zujNx2yD8CwHkreYWcFlt49DP3fYFxeFSY/bqQc+hu44XTcrZS3
	Vfq8DCIo2KzEtu+gcly87U5ze731JfmPHnNfeQWlKCD6CSTy48GPdWs/8P3Er6DwXMc/zQ7+qtI
	cYOBufi1bZDMZIkTOn0sPxnsPnKtg7pFXeO/XRIIbmI4c0XwAz8YSZFxeqDCpYcU8TtgvqAjq6a
	jwEC4cEmc8IKwnTIzFw+HfvFlNhlUT7V9+nPp5H10DVqlyrqerZsd3FY8mPW+CBRlNCp4sAVfhN
	HWi1P6tiTYjincgjLSnELhswGBn007RSdPrueeK8aiCaPAZsbIkJ
X-Received: by 2002:a05:6a00:414e:b0:8bd:281a:5cb0 with SMTP id d2e1a72fcca58-8c8796a7bb0mr34098830b3a.6.1796115743551;
        Tue, 01 Dec 2026 01:02:23 -0800 (PST)
X-Received: from [127.0.0.1] ([43.132.141.20])
        by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8c87285c05fsm19556360b3a.17.2026.12.01.01.02.20
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Tue, 01 Dec 2026 01:02:23 -0800 (PST)
X-Cc: netfilter-devel@vger.kernel.org,
	coreteam@netfilter.org,
	netdev@vger.kernel.org
X-Mailer: git-send-email 2.56.0
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