🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #18373

[PATCH net-next] net: openvswitch: avoid hashing the network namespace pointer

#18373
From: Zhengchuan Liang
Date: Wed, 18 Nov 2026 08:37
48 lines
13009 bytes
The Open vSwitch vport name table uses the network namespace pointer as
the Jenkins hash seed. When an Open vSwitch vport already exists in the
attacker's network namespace, unprivileged OVS_VPORT_CMD_GET requests can
look up attacker-chosen missing names and time whether those lookups
traverse an occupied bucket. Ranking the resulting collision pattern
across possible KASLR slides recovers the init_net pointer and thus the
kernel text base.

Use the namespace cookie instead. It is a stable, unique, non-address
identifier that is deliberately exposed to userspace. setup_net() assigns
it before per-net initializers run, and it remains unchanged for the
namespace lifetime. Fold both halves into the seed so vports in different
namespaces retain namespace-dependent bucket placement.

Found by AI-assisted code review and reproduced on an unmodified kernel
without fault injection. After privileged setup created the resident
vport, the timing measurements ran as an unprivileged user with no
effective capabilities. With this change, the pointer-derived prediction
fails. Existing and missing vport lookups behave as expected. Identically
named vports in separate network namespaces remain independent.

Fixes: 46df7b814548 ("openvswitch: Add support for network namespaces.")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Zhengchuan Liang <zcliangcn@gmail.com>
---
 net/openvswitch/vport.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c
index 083f7a8d9d4e..6689c8370ec1 100644
--- a/net/openvswitch/vport.c
+++ b/net/openvswitch/vport.c
@@ -53,7 +53,10 @@ void ovs_vport_exit(void)
 
 static struct hlist_head *hash_bucket(const struct net *net, const char *name)
 {
-	unsigned int hash = jhash(name, strlen(name), (unsigned long) net);
+	u32 seed = jhash_2words(lower_32_bits(net->net_cookie),
+				upper_32_bits(net->net_cookie), 0);
+	unsigned int hash = jhash(name, strlen(name), seed);
+
 	return &dev_table[hash & (VPORT_HASH_BUCKETS - 1)];
 }
 
-- 
2.34.1
Technical Details
Message-ID: <4e124b37fc972925a825881c50f95eb6b3c2e231.1794989369.git.zcliangcn@gmail.com>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news-ams.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-365955-linux-kernel-netdev=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news-ams.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-365955-linux-kernel-netdev=dewy.ru
From: zcliangcn@gmail.com (Zhengchuan Liang)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next] net: openvswitch: avoid hashing the network namespace pointer
Date: Wed, 18 Nov 2026 00:37:28 -0800
Organization: Usenet Network
Message-ID: <4e124b37fc972925a825881c50f95eb6b3c2e231.1794989369.git.zcliangcn@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2544109"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:UMmeifIoggFhdof/xKeGl6I3QGY= sha256:Wgyp6tCuTiYb95/hkNsbTtzNKL7sVOv8Shz+lRTaBcs=
	sha1:kMBBpcmU94ajvpbvPTb+6oDVhro= sha256:1AXDZXdWiygqo+2c3Ksptxojl/dta8a0tw6VGm7gfzw=
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 48D671151F9; Wed, 18 Nov 2026 11:41:09 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.149
X-Spam-Status: No, score=-3.149 tagged_above=-9999 required=6.31
	tests=[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 NaGGGgk8XYJH;
	Wed, 18 Nov 2026 11:41:06 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-365955-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id 359431151E4; Wed, 18 Nov 2026 11:40:57 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id 8BB7461360A; Wed, 18 Nov 2026 08:40:56 +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=1794991252;
	b=jDY7dDTA/y0CsHayY0aaumm4dJRKDtJOxyhYHmosWwF0ZxpquV60ciH7Lr4ClWmWh/9Q
	 s5HYo9TnwmL55lP67Em67mYmqlwVPsGXTYpo1X4R3N3cz+UxjvMxfO6ifztAIjB/Cx5mx
	 Ji0335stJIKTRZsMQMz3WbMeWwB1Tx2xdvhbV5lZhG9df5A4BkLGaSvJbXhCMzGSEURWU
	 3yGbAqIaoqRS9XtoVUgRh8lGNQYcCmzcxf9NIj7JYwNzyNYNrMkqcWNBqVJDapP+bWFkn
	 sjvg3nLTDILuqepc0qZCm0TPxkpQ45GZFzj2hIeyVtdHpJyIeK28MYKYCOVWEzVuxaw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794991252;
	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=tijoJhJqHiLzmfJFX+bvaWaW5flN5ch0p4c9n0FIh3w=;
	b=Eh5dPd3mcJIU9KN5oEk9mmglc1u/qyZMArp4A41c6esyHsKNtXQgepesFNVStRfIWCun
	 uwQIf/5kWwzr9mC54nBjmePUoRtaKlo1Mp32HL0d5NLi+kXMpgJyWvJfi9HUHG7Rr6vWT
	 qInOsRzkkSBLu4vJIf5Qx59MNeMY7rtkStIhT0VRZ4W/SVdjOxHuQpiB5BhgTq2yFyzwX
	 bbBthAJT9cwMn7LZE7cdONt0P79Ra1AvEKo5I/7z3MakbLSYzcqwPbOSrNtDef/m0QYio
	 mU/1xvq0AvEqZkI2cBUCNI61y8DZOYocDAfhJ1E9FYyqApK0bCWQpdpYJ5ovopAty0g==
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=Ng+LnpIS;
	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 AD128606A8A9;
	Wed, 18 Nov 2026 08:40:52 +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=Ng+LnpIS
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.176
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794991251;
	b=GDo/FlV25Cp1naBqGoh/yw3YfwCI/XxGEFhFZAGKB+unThLv3Gn5mkbyB8jf2d5LEYdv
	 BNif5+tBYnTML5MgDPknU0csx1KVfCXyWqwW9RKw5Rndf2NMLd9YDCqalHFT6+z38OKug
	 B0z+tDx2FVYkVml7Gx+XinY9HBgp2bfvh3SqBHOhE+mFvC7B8ZSDSb/bmrVds8isBg53B
	 3J/WXwfhON1EUaAZauPqp7fxKketzLYjNqSU4tx4zExwH4ylzgfDa+U5BkIksd3eQA93d
	 vj3C11y95yVGDZeHU6LDWSQl8Q3LVBgOVfdEGHoviM8u/gHgoJa4I8cQ6Qzby7EY/7g==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794991251;
	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=tijoJhJqHiLzmfJFX+bvaWaW5flN5ch0p4c9n0FIh3w=;
	b=PYOJapzqXqwWPNGQSSej90GrSZP2kjBC+NIxtLpzPMDp+w98KTPoTJBkoq5kiqRwee9V
	 L2y73Ljv99u/qoAhYARd8yhzSk7tJSX7y6eSw6ubkNvJj6yUnoGntCNJ61yxoA0ChllO5
	 URtftnGhOsYeT3xGTEBC2hb0RGEIFAnhUZvYqLd1Kldf3AKKBMQHZ2mns95nWCVyLfot0
	 aq26FHMpONdmIYvp0eAGH1lJ9sX2Q2IH+SyQV3S9Q96LFh4e93esoY0c6+nPqRHokkRUj
	 w/l4FvbjK5RP8t4on4U/zikxnXhGV7ISmE8VaK75JxNBGExd3hH2vXF7o18UfqPwOLw==
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=Ng+LnpIS;
	arc=none smtp.remote-ip=74.125.82.176
X-Received: from mail-dy1-f176.google.com (mail-dy1-f176.google.com [74.125.82.176])
	(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 0913D606A33F
	for <netdev@vger.kernel.org>; Wed, 18 Nov 2026 08:40:49 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 0913D606A33F
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-dy1-f176.google.com with SMTP id 5a478bee46e88-36f8cdd30beso8051eec.1
        for <netdev@vger.kernel.org>; Wed, 18 Nov 2026 00:40:49 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1794991249; x=1795596049; 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=tijoJhJqHiLzmfJFX+bvaWaW5flN5ch0p4c9n0FIh3w=;
        b=Ng+LnpISPzX+CTmD92puWUFI5csL2ej5pesWPAA0ge+nejhAOJK76/uCfJcESkcR7h
         OUxiM+VgEZ08G8M5owwRQ/88BcbxvktY7aEeEhbzB7N0aCVp2uyDleLX+93NP/Z4fW68
         lmCCwhXLerij2Mg3zaFHAM3+fCJ53sj8b+xqsEpYXpNpKSZJFPaQvI6GDDnykkfUawQm
         iBZu+pLuQhUozDMq1WQ/x2eBzySX5VPx2bZ3snsb9pStn3CsGE/WmsLOH4vNffm6aXvo
         1tTWM6b9xw08Mya23hRuc5RJTp4Ue5fDZ4O1ltpLsCCX+daJT1bO8GEp1i9HfG1SDRIO
         mPRw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1794991249; x=1795596049;
        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=tijoJhJqHiLzmfJFX+bvaWaW5flN5ch0p4c9n0FIh3w=;
        b=qoSyOVRaSfBWx/kad40hz59UsZxahK5PLQUPB6ic8E/Arxob3tZvsCkZcLfuaCPmo4
         7nQb4Eu9U4mBQ6zNZWDfobGc3oywxRU4GTx1ZbMe5zA5m/K1EuR82yheZ69q6EfCqFut
         YsCUslnGsXmR4eD97GA8kbEy4YH/SNFq9V+69k3GXH+aO+KW0qTuYAAuRFUMyb2lZZzC
         SPHloQItr1gwZw6h1EvZCS2s5UGxzd8dz2mv2rZ3T64kTGCvBVbCUlk7yOdX555MzBDZ
         HJgScDELAyRN+hSMxyozCbegyr42ROzj6n4F1lSp0nP5Pz/oiNdiAxKHKRnjKhM4h6W8
         /O8w==
X-Forwarded-Encrypted: i=1; AL+hErFZsNGr86YRA2oUsDMDfLFqnDPvu7mj9QdFICBN6SJyELyxaNKvQs49QENrObsq5pa9af4EkYo=@vger.kernel.org
X-Gm-Message-State: APuU4Z+baHWRS1t15SPMldkWOtvziuqNb8VgICp8Q5harQ6/jZQEaFF7
	t0GpqhnSwz5Kziknt3j4dzjkw6C+gug3bpy3rlZKFkfK186q4e2difmi
X-Gm-Gg: AZFdTZdcwN+B+NIga8sdXr5VApPpV74h3bbnsF6csvK106SlbqopMlu30lBxhQWnFTW
	+EXNxX4NRZJhvFhzzq4yz/E9p635ejmjVahbE76qk9RFzfevzQ0S72rEfCpA/7RENphoXAkT/sA
	jlvBiwqY3ilubwaYgj9lfj/47NpyPwCp2jnFvdgmqm5BodnHHjXE5NNcRmeLB2Sao91Ai4KRpur
	6A+fDFoJrbXAe8LdecfsxjcK1uBT4NVdaNWN0brdecV5eHf7RsYwYfh6fSPMnEW8N7vfGyHJ7UD
	R3FinVWTguqzlTNaFF+wMuDSuBVGkgNsT9njWhci/6g5u8D4hWvWgisnbjbN8tHnFiH/Jz12J5N
	z7ILEAPTuctxFm02M4sVEargmpgHRWAuWZ5G2kGDm+hYGsD58vLArHauj6dhajZUYUJGb180HW9
	3KgmErIxrpD6FSAJO2hPXR87Msd5CRdwQ+qy5JELR2zMVmu+55KrXq4Kbw7tFCP6se6hNMccig1
	fa79d7gpDw4LQ+c7bc+tOiXN1c/eY9DFdvs0h8ZOXqUN+k1JIl1PrgrdLl+k/XgVMaIVC516XHy
	CqE+GAGTSCkzPyrU0SIaVN66tpajdKt3kcfvpUo=
X-Received: by 2002:a05:7300:26a4:b0:382:61d0:f375 with SMTP id 5a478bee46e88-382802697a3mr1982345eec.7.1794991249093;
        Wed, 18 Nov 2026 00:40:49 -0800 (PST)
X-Received: from kq.cs.ucr.edu (kq.cs.ucr.edu. [169.235.27.223])
        by smtp.gmail.com with ESMTPSA id 5a478bee46e88-382a63059e3sm8528784eec.5.2026.11.18.00.40.48
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Wed, 18 Nov 2026 00:40:48 -0800 (PST)
X-Cc: Eelco Chaudron <echaudro@redhat.com>,
	Ilya Maximets <i.maximets@ovn.org>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	Pravin B Shelar <pshelar@nicira.com>,
	Jesse Gross <jesse@nicira.com>,
	netdev@vger.kernel.org,
	dev@openvswitch.org,
	linux-kernel@vger.kernel.org,
	Zhengchuan Liang <zcliangcn@gmail.com>
X-Mailer: git-send-email 2.25.1
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