Article View: linux.kernel.netdev
Article #22301Re: [PATCH net-next v2] net: openvswitch: avoid hashing the network namespace pointer
From: Zhengchuan Liang
Date: Wed, 25 Nov 2026 05:51
Date: Wed, 25 Nov 2026 05:51
80 lines
15329 bytes
15329 bytes
On Sun, Nov 22, 2026 at 7:46 PM Ilya Maximets <i.maximets@ovn.org> wrote:
>
> On 11/19/26 10:20 PM, Zhengchuan Liang wrote:
> > 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. Hash the cookie down to a 32-bit 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.")
> > Reviewed-by: Eric Dumazet <edumazet@kernel.org>
> > Signed-off-by: Zhengchuan Liang <zcliangcn@gmail.com>
> >
> > ---
> > Changes in v2:
> > - Use hash_64() rather than jhash_2words() to derive the 32-bit seed.
> > - Use u32 for the local hash value.
> > - Drop Cc: stable because this net-next change is not a stable candidate.
> > - Drop the deprecated Assisted-by trailer.
> >
> > v1: https://lore.kernel.org/netdev/4e124b37fc972925a825881c50f95eb6b3c2e231.1794989369.git.zcliangcn@gmail.com/
> > ---
> > net/openvswitch/vport.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c
> > index 083f7a8d9d4e..04e4df103b26 100644
> > --- a/net/openvswitch/vport.c
> > +++ b/net/openvswitch/vport.c
> > @@ -4,6 +4,7 @@
> > */
> >
> > #include <linux/etherdevice.h>
> > +#include <linux/hash.h>
> > #include <linux/if.h>
> > #include <linux/if_vlan.h>
> > #include <linux/jhash.h>
> > @@ -53,7 +54,8 @@ 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 hash = jhash(name, strlen(name), hash_64(net->net_cookie, 32));
> > +
> Sashiko had a nice comment about using net_hash_mix() as a seed, which
> seems to be a good idea as it fits the use case pretty well.
>
> Best regards, Ilya Maximets.
That would allow an attacker to recover the 32-bit net_hash_mix, which
is reused by other networking hash tables.
Best, Zhengchuan
Technical Details
Message-ID:
<CAOny8pvHhv2UVYSv++pukE+0+G5+JNirQiGGVS3=O0Rrvw22BQ@mail.gmail.com>Path:
mbox-mo1.pugleaf.net!srv.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-371038-linux-kernel-netdev=dewy.ruReferences:
<b2853b9410d049e08b3e2ae2491e775506b4f0e8.1795122681.git.zcliangcn@gmail.com> <e6d7aa66-3df1-476d-a8cb-359827cd8243@ovn.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.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-371038-linux-kernel-netdev=dewy.ru
From: zcliangcn@gmail.com (Zhengchuan Liang)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v2] net: openvswitch: avoid hashing the network
namespace pointer
Date: Tue, 24 Nov 2026 21:51:02 -0800
Organization: Usenet Network
Message-ID: <CAOny8pvHhv2UVYSv++pukE+0+G5+JNirQiGGVS3=O0Rrvw22BQ@mail.gmail.com>
References: <b2853b9410d049e08b3e2ae2491e775506b4f0e8.1795122681.git.zcliangcn@gmail.com>
<e6d7aa66-3df1-476d-a8cb-359827cd8243@ovn.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
logging-data="125145"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:cr/UcKfq1iMD0MSBBR24sxK8yGU= sha256:n2e4rKGiqd3fXSY96rGx+NUdYloG0AIZFjtYJ5yOO2Y=
sha1:1NBMICaDf2r+hT+R+a/qCe29Qbc= sha256:IvuX3CCjFwhB67E0b4NnrfoQi9aGambYCuQz8H8SQA8=
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 BD6B7125E3A; Wed, 25 Nov 2026 08:51:37 +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 gA4K6_CF8xIp;
Wed, 25 Nov 2026 08:51:29 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-371038-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 660F2125E35; Wed, 25 Nov 2026 08:51:20 +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 BAB3B39B4B; Wed, 25 Nov 2026 05:51:16 +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=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1795585875;
b=Mvs32nOLc9Gd1MO0QfWUr9zd2e93O1fB14cOwtfFpbNXCwh9tGEU7EFyilpMMN5GhEom
jK7OosR51XmDHCYD5aMctd4k+n87KmUbimlWVc5pxjujgiyUqF6tKgzbU6DkftAXW5YQs
QAYHvVFx6sj6f4OD+DfV2G3v04DkdF7iUo3IASkACt21hm9gsCypfmEHS+3/A+tqGhssW
34LQfoLyRqooC/q789RCJQRJ/wUsB1PLYsqUuj+5VjZps8451y9p3eiZxcvJw+jkilJWo
F7vuH5EoLy5I0u3MAzTkFjSORL7BNbYdlqtN8vktwIzmTGJMgC4ulD2ZKTc6umc7YLQ==
X-ARC-Message-Signature: i=3; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1795585875;
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:X-Mailing-List:List-Id:List-Post:List-Help:
List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
References:In-Reply-To:From:Date:X-Gm-Features:Message-ID:Subject:To:
Cc:Content-Type:Content-Transfer-Encoding;
bh=9T8VWNlC22pM1qjvLbYEaQzBzJ9S1PZJc2NX6XMx7dE=;
b=Tc3X+E+D8qHj7pxDIK//1Enxn5OJmVUqlNME5IMZdj09peH8DklpuLxLgfdohTrUByuc
tredfrsyp9R7EsMgwYrRgriyiLP2iP5/fWNFBNk7xf16UWTLp00UUHd75f92/EkfoMrNn
FkA4wVrOoP1BxMo/0Jk2YVcQ+pG+LefmRl85DMVvp+Y+vJ58L8XmabdQtBA9pH7MKScpv
ewXlokec38uRek/tBc2Rd6EKmzrjqBXx8gZeuL5IYPUHzZm8Wn5TrS1iQMxxg9EMWmFPl
NyVnmqtBnpvK74qIakabg4taNfkqYUMSvNdKPg9kDSDDRO96RKaSCS6EhiGeAenehIw==
X-ARC-Authentication-Results: i=3; smtp.subspace.kernel.org;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=sfb4J9CF;
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 C7711606A32D;
Wed, 25 Nov 2026 05:51:15 +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=sfb4J9CF
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=74.125.82.171
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1795585875;
b=rgX0ZgyFWZAkgMi5GHWgLGOdVQyonAmYHn+tbaOsgDtNdOvR/XLdNIAQFdtRpFj7Y8Lp
zFZiQbTd9Z9WnJYPx+wk610sqBEQtsnMjVrfQax46UGj58s93vsh/d1LjVN04m952A1bO
EUPWmdyqH6ilprycevjGeJLwLYv3j9cudvwElLQxLRjPH40Fi5ejW7FbqRxomnZ1n5OyI
T1rAU4XmEgZHWccWMDMgq1JKqAbx5jPgZX5uupIvUSQRAOoNLhkEAyOpKTdLJ/eApCf4o
EbH6xn6SGClkA4CaIH3B2PNqg6IQqHvCxO0mifL8sGrT7ghf8G11YcDAkWS7VqKS7gA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1795585875;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:
MIME-Version:References:In-Reply-To:From:Date:X-Gm-Features:
Message-ID:Subject:To:Cc:Content-Type:Content-Transfer-Encoding;
bh=9T8VWNlC22pM1qjvLbYEaQzBzJ9S1PZJc2NX6XMx7dE=;
b=0uhcKenO/OITkQoW5YxWasoPRose8Zp2mc00WRrJCbZTWwWBTce5fBRQO9RE8PrmTNR/
8+IwvMTV2k8EMHduBkPWeKxxXRte2G1+MAQmevupXh9CUM4JxJYVEF8HL3C5CSAzc9nor
zUZjxV0DOIHNrq6SOTaPHMW61QSOacmVvkz1zYc5O0v+oCjI3KJ+ljIXTAN95fKebJFAo
37fzVuP3wlB4s/QdUJcK5Q5Q1zx1PsAJ51uS6CiCzM3lKW47PuxWsKSV7POAiagv9IKpt
R4W3cEy5gVHEHxDwn44xZ3kOq9i83+AyA507M4t3kw4MUmW5jWHic3j7qLJZtFLrVYQ==
X-ARC-Authentication-Results: i=2; 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=sfb4J9CF;
arc=pass header.oldest-pass=0 smtp.remote-ip=74.125.82.171
X-Received: from mail-dy1-f171.google.com (mail-dy1-f171.google.com [74.125.82.171])
(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 9631B606A31E
for <netdev@vger.kernel.org>; Wed, 25 Nov 2026 05:51:14 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9631B606A31E
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-f171.google.com with SMTP id 5a478bee46e88-38190551625so10753376eec.1
for <netdev@vger.kernel.org>; Tue, 24 Nov 2026 21:51:14 -0800 (PST)
X-ARC-Seal: i=1; a=rsa-sha256; t=1795585874; cv=none;
d=google.com; s=arc-20260327;
b=brMYWv23YYYI7dcBr/mh25pWgnZOYitpi+qTfqpZgLn+Zq/rUTrBgfneoPtgxw7Cj/
aOy2TjF4OEfG+hxm+ql42BD91zEl9tdpw03JgQoOBZxik64ZYrFrR3aVtcPW7cOfrtg0
uebBFzaWXqGFMHCpTTCYMjzXv0O1ZXaj22Ql9kaCQ2Gj/btyRTooc6ZiL9CuvI3px9Yt
d86LxAjg+5KjFX4VvZ0VwJW4HrDd6/rgfDeEoHVQlJscn+kl9RxDzs/sivxjsXc8MCZm
S8YCcafyEY6shaFtUy/3e8RivL9OvqIxN68QeJZ7C5uSBVFWfaja/cXGAwLe4eoLcCyR
eNUg==
X-ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:dkim-signature;
bh=9T8VWNlC22pM1qjvLbYEaQzBzJ9S1PZJc2NX6XMx7dE=;
fh=xjbIVLM3JuqKRMjvGvavZh92/wxj4Dgr5a6Kf5Gkc9k=;
b=GBgJTqpZcrz8ALzNdCfsuiioHe8SQ1/EoerpaPZxako4nFBbTeqxAudbp5zvYaUWZr
9jeuxzodrcLEbPB0yBe4Xy2Y9YUmUg9Al65nWsxgopVoaETx5wHRcpiiy3HJQZuYXyTv
VfXQ3qHwHI1WYpfK+PHK/s9BaDlxiXPFl91qLZHnmbjCXydIVebuQt972PQ7GChQx0L4
XSm7TtIwCRRD98NQyhjBojkymz9Lga9rdCtbElsZwFXQ5jsEzN2lzJlR3qzFqP4jITol
hecGWGhKi6b5Heopu72MSDSFbqbGJ3go+59v+YX3ONytU3NxcWkSg1Cso6uVRP9hdOHN
y+sw==;
darn=vger.kernel.org
X-ARC-Authentication-Results: i=1; mx.google.com; arc=none
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20260707; t=1795585874; x=1796190674; darn=vger.kernel.org;
h=content-transfer-encoding:content-type:cc:to:subject:message-id
:date:from:in-reply-to:references:mime-version:from:to:cc:subject
:date:message-id:reply-to:content-type;
bh=9T8VWNlC22pM1qjvLbYEaQzBzJ9S1PZJc2NX6XMx7dE=;
b=sfb4J9CF+5yjZ/x/Iu7BFWCbJgOx5jjpqUiqLSNFSquy1M0qtMmn27RFXaMWciCfMn
eEjJhWhPQSG7f63esOhYIuCQitedZEjca26PsfPOt0YMtriD5xjj2MZiVf/3ZLx2QFOl
+Wg52BMCp1fizm2tYTbNHuH6IB3qhIxgD6Sg4JY4mKEL3EH4WPSbrWAntLcKznqcLIaa
ux57gd/YQObMfbtzn7M4iNGX12h/6aeDyT6qGEjv82ySLL740fsUb6n9NDMZHEWe1CJX
O9B2LRVmpPCj0g9iF1MJGLwxImwsCwIiQ7YhgJZ+CSqej/saT+XCQTxjkM7MkX6YxelR
bm5Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1795585874; x=1796190674;
h=content-transfer-encoding:content-type:cc:to:subject:message-id
:date:from:in-reply-to:references:mime-version:x-gm-gg
:x-gm-message-state:from:to:c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IvnvTcg9LBV0ZBMbd8ldoFu/8HnnoH
+OMHpEj8+7lEdQGXXqJqqCmMOaQ6dbHeJH6+Aedw=
X-Received: by 2002:a05:7301:140b:b0:386:ca0e:430a with SMTP id
5a478bee46e88-386ca0e44c5mr2612452eec.24.1795585873408; Tue, 24 Nov 2026
21:51:13 -0800 (PST)
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-In-Reply-To: <e6d7aa66-3df1-476d-a8cb-359827cd8243@ovn.org>
X-Gm-Features: Aa3M54pDG29o7dVlFlqPFuvbM77f8i9ZHjtQ98m_VMlQguub6jqHv5TZuSqbqlU
X-Cc: Aaron Conole <aconole@redhat.com>, Eelco Chaudron <echaudro@redhat.com>,
"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>,
netdev@vger.kernel.org, dev@openvswitch.org, linux-kernel@vger.kernel.org