🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
1 messages
1 total messages Started by netdev-bot+sashiko Sat, 28 Nov 2026 23:57
Re: [PATCH net-next v3 12/12] Documentation: networking: psp: document socket-less associations
#24001
Author: 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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads