From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 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== 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== 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 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) 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 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66B691F00924; Sat, 28 Nov 2026 23:57:13 +0000 (UTC) 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== Subject: Re: [PATCH net-next v3 12/12] Documentation: networking: psp: document socket-less associations From: netdev-bot+sashiko@kernel.org To: toddfreed@meta.com 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 Date: Sat, 28 Nov 2026 23:57:12 +0000 Message-ID: <179591023298.3135.1979599296882627953@kernel.org> In-Reply-To: <20261124221758.3230929-13-toddfreed@meta.com> References: <20261124221758.3230929-13-toddfreed@meta.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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