🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24001

Re: [PATCH net-next v3 12/12] Documentation: networking: psp: document socket-less associations

#24001
From: netdev-bot+sashiko
Date: Sat, 28 Nov 2026 23:57
131 lines
13770 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] Socket-less Rx SPIs are not tied to an owner or a key
  generation, and the new 'Socket-less associations' documentation…

--

Documentation: networking: psp: document socket-less associations

This patch documents PSP associations and how the socket and tc use cases
differ. It covers the new socket-less netlink commands (rx-spi-alloc,
assoc-add, assoc-del, assoc-get), the psp tc action and the flower
psp_spi/psp_ver/psp_dev matches. It also adds sections on fragments and
statistics.

> diff --git a/Documentation/networking/psp.rst b/Documentation/networking/psp.rst
> index ceb1e232317fc..fc565d48c6947 100644
> --- a/Documentation/networking/psp.rst
> +++ b/Documentation/networking/psp.rst

[ ... ]

> @@ -162,6 +185,92 @@ or the PSP version of the association. It is rejected with ``-EBUSY``

[ ... ]

> +- ``psp decap`` removes the PSP Rx state (the ``SKB_EXT_PSP`` extension and
> +  ``skb->decrypted``) of a decrypted packet, so that it can be forwarded. It
> +  takes no association. Its filter should match ``psp_spi``, ``psp_ver``
> +  and ``psp_dev``.

[ ... ]

> +Unlike for sockets, the kernel does not enforce key rotation for
> +socket-less Rx: a decap rule for an SPI also takes the packets of a later
> +allocation of the same SPI. Userspace which installs decap rules is
> +responsible for removing them in time:
> +
> +- Any process with ``CAP_NET_ADMIN`` over the PSP device can rotate its
> +  key, or allocate SPIs with ``rx-spi-alloc``. Any process with a TCP
> +  socket in a network namespace where the device is visible can allocate
> +  SPIs from the same space with ``rx-assoc``. Once the device has rotated
> +  twice, either can return an SPI which a stale decap rule still
> +  matches, and the rule would strip the PSP state of its new owner's
> +  packets. Remove the decap rules of the SPIs allocated before the
> +  previous rotation before rotating the key again: right after that
> +  rotation, the device may allocate their SPIs again. When another
> +  process rotates the key, remove them as soon as the rotation happens
> +  (``key-rotate-ntf``); until then, an SPI allocated again can be matched
> +  by a stale rule. This is simplest when one process allocates the
> +  socket-less SPIs, owns the decap rules and rotates the key. Move peers
> +  to new SPIs before the next rotation.

[Severity: Medium]

This text says a stale decap rule can match another owner's traffic, and it
leaves the cleanup to userspace. Is that isolation model safe when the SPI
space is shared with rx-assoc, which does not need privilege?

The code behind this was added earlier in this series, in "psp: add support
for socket-less psp associations", "net/sched: add act_psp for psp
transport mode" and "net/sched: flower: add psp_spi, psp_ver, and psp_dev
matches".

PSP_CMD_RX_ASSOC in net/psp/psp-nl-gen.c has no GENL_ADMIN_PERM:

	.cmd		= PSP_CMD_RX_ASSOC,
	.pre_doit	= psp_assoc_device_get_locked,
	...
	.flags		= GENL_CMD_CAP_DO,

psp_nl_rx_spi_alloc_doit() keeps no record of who owns an SPI or which key
generation it came from:

	/* Nothing to keep: the SPI is only matched by value (flower) */

For TCA_PSP_ACT_DECAP, tcf_psp_act() then strips the Rx state whenever the
flower psp_spi/psp_ver/psp_dev match hits:

		skb_ext_del(skb, SKB_EXT_PSP);
		skb->decrypted = 0;

Socket associations are checked per packet through psp_pse_matches_pas().
Nothing like that happens on this path.

SPIs really are reused after two rotations. nsim_key_rotate() resets the
counter for each phase:

	if (ns->psp.spi & PSP_SPI_KEY_PHASE)
		ns->psp.spi = 0;
	else
		ns->psp.spi = PSP_SPI_KEY_PHASE;

So the following can happen before the rule owner has handled
key-rotate-ntf:

  admin:            rx-spi-alloc -> SPI X, installs psp decap rule for X
  any CAP_NET_ADMIN holder over the device:
                    key-rotate, key-rotate
  other process (possibly other netns, no privilege):
                    rx-assoc -> SPI X
  its peer:         sends PSP traffic to SPI X
  stale rule:       strips SKB_EXT_PSP and skb->decrypted

Once the victim socket has a Tx key, would __psp_sk_rx_policy_check() drop
those stripped packets with SKB_DROP_REASON_PSP_INPUT and blackhole the
connection?

If the stale rule also redirects or forwards, could the victim's decrypted
plaintext end up somewhere else?

The flower commit message says the device key generation is not checked
and that userspace must handle it, so this looks like a deliberate
trade-off. Could the kernel tie a decap match to a key generation, or keep
socket-less SPIs from colliding with rx-assoc SPIs? Either would avoid
depending on userspace reacting to key-rotate-ntf in time.

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261124221758.3230929-1-toddfreed%40meta.com
Technical Details
Message-ID: <179591023298.3135.1979599296882627953@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373296-linux-kernel-netdev=dewy.ru
References: <20261124221758.3230929-13-toddfreed@meta.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373296-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v3 12/12] Documentation: networking: psp:
 document socket-less associations
Date: Sat, 28 Nov 2026 23:57:12 +0000
Organization: Usenet Network
Message-ID: <179591023298.3135.1979599296882627953@kernel.org>
References: <20261124221758.3230929-13-toddfreed@meta.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1062475"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:M1Cwhoisot9pA4V2Tur0HMOl39o= sha256:H0c6b6R637eN+q4DDgXMX6n9sM3qc/uDC4EwinWR/Sg=
	sha1:A32JUi+MUBBzWIXMzbf9NN6Dma8= sha256:4OESY+hANj0QE2Vum/YacB9baDy/lT9b6keBOHN1xiA=
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 6118E125F88; Sun, 29 Nov 2026 02:57:38 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, 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 amc-GwCLwE6p;
	Sun, 29 Nov 2026 02:57:34 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-373296-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 5D476125F91; Sun, 29 Nov 2026 02:57:24 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id AA65F27D2D; Sat, 28 Nov 2026 23:57:20 +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=1795910236;
	b=MW+oy9UbAEQMSrbppyl6vE99Lq/ZozV2qYoCZH5nfXf/ykXTyAdXBdk7UuvEdtfgtSEx
	 rJJc8Dr7prPhSXq2MtOYnkuOgE4li1aseroUIngMagMxlR+4kklVHLlq3Bsyc62wPIEtX
	 /Myt3ZEldnDElOtW8mbQWFPYsWpO3pwQEvfiiCv6QUPwCL3FFVGzpQKyHgO87kv+HKp6M
	 AZLBfKIxidXkpxRPPEnmkvtqrh4+eQQua1pVlp4f7wPGKkwfkeCteCDLdZNacbXrBnrMX
	 pnFXXZUG2N/fkyj9cKzOkZQr+KTXiChfpopNP5QAYpxTVE8fHATMbmZk5lovWbpXaYg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795910236;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=WEOQTlLG/DDI/s+fmAGKuNIEC38D7wrakeSUOboY+bo=;
	b=3YXsLfBRr0SzNww8loNSaGVgSCuNLQ/9AdBrvMCCUUbRtm67BJgwwFFxOkzVH6W7kPDt
	 9YsChduGO3LQQfps0X00IZZKeLK80l2rtM1FsNDoIxwML1GpMkA7orAU60kGoZsiRDBje
	 CidtoAH7BBGv6JTd0HOdeIufTmwy1ExjU0EtCpLxCFGQMcKg4fHdoD7x2KDNlh+Ix6KFU
	 uQzbB96/+qsfGq6cjkAxt3DVOs39HGTpEHSroWCTYXv+vyMNqThmEHE99w9thAnxZmHsE
	 o7l4yCena41BSpL+DELEvLG2MnNadeiWZj/Rfn3vB+IGu/LvuFQp7Ae9NbdZTMhZXtw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=cCLUloaM;
	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 BE903606A68F;
	Sat, 28 Nov 2026 23:57:16 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=cCLUloaM
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795910236;
	b=d0d3OJB5X/C/vF7+cJ3lPKiA8wHn/+jT41hkLwBaP4uwoE/Y3V/Va1PHX17Tawj0YKFJ
	 wOhWBO/l0EWK7JT4jNmeheVEjdroBJ9wKJHFjGIpO/KgmeSOxlizqiSKuYqKyLkAtSoca
	 A0MVqvK26ThiPKXuNwBen33Qp7BCBmAc+O/+6e/NbTANCYPZy39JSA7ckjU5trULueCsC
	 PU+4uwDe/zVkXiSpU7T4JzuL9TnnK5XmGXr2DkRpX8CUJJaBXCyOvuUMH9D/XLhhKjh/6
	 TaF6sF9w2cbZejHDFuYI5NOQ5iJ3YHqT2JCdcn6o2s6V4nmPiBMDe08zT8HCl4a+VeA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795910236;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=WEOQTlLG/DDI/s+fmAGKuNIEC38D7wrakeSUOboY+bo=;
	b=HfQq5fG1iw6/7ycQGuy4AzZA9a5a1tmxIb8da0SJYfwOsG/sKlW+8mwPuhTgf4N+eQuP
	 e6Pl+aSRYEqxS7G6Lc5cn3knslhgbyoWof7hss/xTTQjh2G8Ltjca7pWhgM+bis19JFLS
	 CayD2wbPwSWW9pRb8X5eF4t31OGtUjRsEPDf3OLzuczDfxQ4rfyKL1VbPmkVHeoQw0daM
	 yXqWI8nKQK4rmBGj79HLFJNJJsjO9F1P3GcpSSB462HdOx6VbFezLsVYps/GhwPdCOiym
	 MgOK5qmf+9VQEDN/o/n1Aa5aBcTNTOLDfBCSC3MJyv0HJpBqOhKdaCEyJsvPwrrDsCQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=cCLUloaM;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id E036D606A69A;
	Sat, 28 Nov 2026 23:57:15 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66B691F00924;
	Sat, 28 Nov 2026 23:57:13 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795910235;
	bh=WEOQTlLG/DDI/s+fmAGKuNIEC38D7wrakeSUOboY+bo=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=cCLUloaMeJ2xGNeqhLkyuZT0033JiyjzkbrMWb6NkNh9FH4a+u5ORlnlBidTgznq8
	 4obwhMT0d+aYPY2tg8brr4dVMHDVwHb6RaHr/Dun3dZtRSDaZzzGAoL9aFa2OBfcew
	 CLzzpb27nQ1ogeHFvod7JXutahqrmufwjSkhyfsC9+HxU8N2sk/pj3I2jUR0H1ZF2H
	 58pc18oCy7Wx74p8dHWGpkOPL06cFS+O21vWyYaBzpJ31xo9z5DCI7xB7qQePS73tW
	 FyFViTsk7SyweOMaYzeYy7+m/mrFfGBEwIseiRTI4yhbUOyJ/8uOV6NJ/Oqu4x2wqc
	 BZp5z1sNprscg==
X-Cc: netdev@vger.kernel.org, davem@davemloft.net, andrew+netdev@lunn.ch,
 bjorn@kernel.org, borisp@nvidia.com, cratiu@nvidia.com,
 daniel.zahka@gmail.com, donald.hunter@gmail.com, dtatulea@nvidia.com,
 edumazet@kernel.org, kuba@kernel.org, jhs@mojatatu.com, jiri@resnulli.us,
 leon@kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
 linux-kselftest@vger.kernel.org, linux-rdma@vger.kernel.org,
 mbloch@nvidia.com, pabeni@redhat.com, pctammela@mojatatu.com,
 saeedm@nvidia.com, horms@kernel.org, tariqt@nvidia.com, weiwan@google.com,
 willemdebruijn.kernel@gmail.com, kuniyu@google.com, bpf@vger.kernel.org,
 ast@fiberby.net, qingfang.deng@linux.dev, toke@redhat.com, shuah@kernel.org,
 corbet@lwn.net, skhan@linuxfoundation.org, rdunlap@infradead.org,
 matttbe@kernel.org, dsahern@kernel.org, j.koeppeler@tu-berlin.de,
 hangbin.liu@linux.dev
X-In-Reply-To: <20261124221758.3230929-13-toddfreed@meta.com>
X-sashiko-severity: Medium
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