πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #18332

Re: [PATCH net-next v4 1/5] psp: support rx rekey operation

#18332
From: netdev-bot+sashiko
Date: Wed, 18 Nov 2026 06:05
122 lines
12484 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] At this commit, Documentation/networking/psp.rst says a PSP Full
  connection can be rekeyed in place 'using the same netlink calls as in…
- [Low] The new field pas->prev_generation is written with a plain read-
  modify-write (`pas->prev_generation |= ~PSP_GEN_VALID_MASK`) in…

--

psp: support rx rekey operation

This commit lets rx-assoc run on a socket that already has PSP state.
It creates a new psp_assoc that keeps the existing Tx state and gets new
Rx state. The previous Rx SPI and generation are kept as a fallback, so
packets the peer sends with the old key are still accepted until the
next Rx rekey or device key rotation.

> diff --git a/Documentation/networking/psp.rst b/Documentation/networking/psp.rst
> index 0f9b6b73f2447..fab797506b0a9 100644
> --- a/Documentation/networking/psp.rst
> +++ b/Documentation/networking/psp.rst
> @@ -140,14 +140,33 @@ The PSP assoc state of a socket is not reset when the connection is
>  torn down. ``connect()`` on a socket that has PSP assoc state will
>  return ``-EINVAL``.
>  
> +Rekeying
> +--------
> +
> +A connection which has completed the exchange described above and is
> +in the "PSP Full" state can be rekeyed in place without being torn
> +down, using the same netlink calls as in connection setup.

[Severity: Low]
Is this accurate at this point in the series?

To finish the rekey, the peer has to install the new SPI and key with
tx-assoc. At this commit, psp_sock_assoc_set_tx() in net/psp/psp_sock.c
still rejects tx-assoc on a socket that already has a Tx key:

	if (pas->tx.spi) {
		NL_SET_ERR_MSG(extack, "Tx key already set");
		err = -EBUSY;
		goto exit_unlock;
	}

An application on a kernel at exactly this commit that follows this
text, or the updated "Applications are expected to rekey their
connections" wording in the Rotation notifications section, would get
-EBUSY from tx-assoc on the peer.

Later patches in the series close this gap:

- "psp: support tx rekey operation" replaces this branch with a call to
  psp_sock_tx_rekey().
- "psp: defer tx key deletions for SADB drivers" removes the temporary
  -EOPNOTSUPP for SADB drivers.
- "selftests: drv-net: psp: add rekey tests" adds test coverage.

The final psp.rst also documents the tx-assoc rekey path.

Could the documentation changes move to the tx rekey patch, so that the
docs match the code at each commit?

[ ... ]

> diff --git a/net/psp/psp_sock.c b/net/psp/psp_sock.c
> index f2cba3fa3a235..c1e38845f08c3 100644
> --- a/net/psp/psp_sock.c
> +++ b/net/psp/psp_sock.c

[ ... ]

> @@ -302,8 +333,21 @@ void psp_assocs_key_rotated(struct psp_dev *psd)
>  	 */
>  	list_for_each_entry_safe(pas, next, &psd->prev_assocs, assocs_list) {
>  		pas->generation |= ~PSP_GEN_VALID_MASK;
> +		pas->prev_generation |= ~PSP_GEN_VALID_MASK;
>  		psd->stats.stales++;
>  	}
> +
> +	/* Don't allow SPI from two generations ago to alias one from the
> +	 * current generation. Rx rekeying under the same device key generation
> +	 * is currently permitted, so skip if the previous SPI is from just one
> +	 * generation ago.
> +	 */
> +	list_for_each_entry(pas, &psd->active_assocs, assocs_list) {
> +		if ((pas->rx.spi ^ pas->prev_spi) &
> +		    cpu_to_be32(PSP_SPI_KEY_PHASE))
> +			pas->prev_generation |= ~PSP_GEN_VALID_MASK;
> +	}

[Severity: Low]
Should these updates to pas->prev_generation use WRITE_ONCE(), with a
matching READ_ONCE() on the reader side?

psp_assocs_key_rotated() holds only psd->lock here. The field is read
without that lock in psp_pse_matches_pas():

	(pas->prev_spi && pas->prev_spi == pse->spi &&
	 pas->prev_generation == pse->generation));

There are two paths to that reader, and neither takes psd->lock:

- __psp_sk_rx_policy_check() from tcp_v4_do_rcv()/tcp_v6_do_rcv(),
  under the socket lock.
- psp_twsk_rx_policy_check() from tcp_v4_rcv()/tcp_v6_rcv() and
  tcp_timewait_state_process(), under RCU only.

These are compound read-modify-write stores, so KCSAN can report them
even with CONFIG_KCSAN_ASSUME_PLAIN_WRITES_ATOMIC.

pas->generation already uses the same unannotated pattern. This patch
adds a new field and a new writer loop over assocs that are attached to
live sockets.

-- 
Sashiko AI review Β· https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261116-psp-v4-0-1a599df2aefa%40gmail.com
Technical Details
Message-ID: <179498190320.3136.17281959209989358635@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-365896-linux-kernel-netdev=dewy.ru
References: <20261116-psp-v4-1-1a599df2aefa@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-365896-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v4 1/5] psp: support rx rekey operation
Date: Wed, 18 Nov 2026 06:05:03 +0000
Organization: Usenet Network
Message-ID: <179498190320.3136.17281959209989358635@kernel.org>
References: <20261116-psp-v4-1-1a599df2aefa@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network; logging-data="2519174"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:ieP6V+wpFQ/3KNjsCuhsfLFaEIE= sha256:ffFNPxBUQ83kiPRaXmIK1sOMOVOKY6jz33nrUcvZWKE= sha1:2lz6+l8B1rTcONgaE+cxcFldXS0= sha256:am8ncUdTCMx88rRFjuYo0aEv7+F+VR2BT7242W+/hEM=
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 2DAC91151C1; Wed, 18 Nov 2026 09:05:48 +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 qHnBC4QAnLej; Wed, 18 Nov 2026 09:05:44 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-365896-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 6734F115127; Wed, 18 Nov 2026 09:05:36 +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 7DE07398C8; Wed, 18 Nov 2026 06:05:06 +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=1794981905; b=J2CsMGa9PSxXDQOjliTVPgO2/AuDhQZ6QMAlzVbgQVs7itXZYplCLEGfQ+YBZJxA4bmX hf85geG8omhN+vnaswVzg2MmyJE157HHo1CUjB36dcLO3SlkrTwraihcOu1WpKo/DhE6l jFOnbpeS3JKC+y27mHthCC8C/wx3JqBkLNRaxm6coGeFBSNOCjrhrlsaSgl2z8jVjG6Ri O24rucq7UHV9NrAVnOLMIB2YZJdgufce1gBgZlbbPMwkkp1LDuWdmc4Cb3qkx9kCNOIr1 bAggMUMtO4pLZy5jHKPVVHEJRDCktAccXdjiUPOQfk6DqxHvaWUUbXOoHeGFZIYUXww==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794981905; 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=pZzl5p/hTAG4Ht/7wLb4wKQYy+e/CeEZTrM3kv/McxQ=; b=CMUofHJn6bxXdHc74aF1eMR4ezfRpFCMD+9MSd3WnVWwxYihEPg2V+z5BtCV08uc+Ta3 6NFsHcaN+LNPx3wp1gzYnM8+MSH0ooOBp4yqyGW09YANqtDpou0PxXpH9lamE6vqCZAOW GhtJev30Nl9BE05G8YG4DhTyhDfDqosSkzVtDm549AcA9tR9xq619hrUvmFMIwvKlM629 GJv8q/3PXKggnqjVKCAWDdPAfUAI7qO//2mE2vYOswUHlI8N0vfOLbMWZNV0LQww57NlY 70SqNh/vYvlSXDl5+FxoTbOZO38s/0NP/WK0B4SzRB1Ow/6G0de51ErLeY7VqHwwRoA==
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=RkV1PYiv; 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 D5B64606A32A; Wed, 18 Nov 2026 06:05:05 +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=RkV1PYiv
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=1794981905; b=gsIuMOY6gBI9fZVYfgQNfTVBU7aPuxHQGoqWNKsV0Y4yg6mggQ4DS7AUY7P4PDJNepg9 B76lbpoDfIttmm2xbuvaiTSIBZ2cv5H/PgUkhmFUzADyx3jG1bgOVyTHRN88VkSggCJ+q ZoTiLi6QkCbJ5/Vpzru5ThwCYXLC0SXpeH3IbV6UtJU6xpw5a7qxKauVMTV47F4Aw/ysr NUrgE+kXEmNyQpDzPeZrJZlMoBfPLpxtQzMbuO2Lxnp8mi0eiKqZO12r2IqTt4dmvoc+Z Hzqcko8gJn52pNfJ9CTMh8blsQ1n2S/iwVxmzQrCUcFwMdb4rPpM1OkWpANBzZ39uTw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794981905; 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=pZzl5p/hTAG4Ht/7wLb4wKQYy+e/CeEZTrM3kv/McxQ=; b=vgIJVigmkfAsZjlOWjEyfPu9JV3cIJ03DCJ2OEaDE1S38X08h6jLMbT+aLhJvHhemOD2 xRiXSmoAZ0pSXUjMZgT1GhOjIjewnsVs24gEA8+DXKCtl46oIU4OsrELfCVnDbZKKmvPU mWCJF3JltWdwDpGC+nlfQTRaUI/mSzAFh9TXU0QnGO2ranun350z/XMHIwx3RZA0rK2hb MbStwIUsC3OVupI3vALN0jnZRnVGUp+kG3sURmjlot/4d8yv0aKOkLwApYWK3JvJdy+Xk W+o/1Wt03bNpuV10J+1pJ0Vl4p+JxxDdd9QLoGoyEr8BZfRdEJRyNE9CML3f6aSmuxg==
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=RkV1PYiv; 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 F3F99606A32C; Wed, 18 Nov 2026 06:05:04 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id A05921F000C5; Wed, 18 Nov 2026 06:05:03 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794981904; bh=pZzl5p/hTAG4Ht/7wLb4wKQYy+e/CeEZTrM3kv/McxQ=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=RkV1PYivYA3eGorJO/HZ12M7pw27SKD7L808WC4wcZIFV2ycMe2LPmRlSx7B+8qb9 /MDBC2Duj8l13ipWztq/cG+V55RB3pWd3B0tZFJOzahMnthrXXHrnqAEdM392fYHMv 1kVkOpH2x3kKdy7RcIO6BJgcZHzeS7hOd8HTUGS7JIF5xRicRKIkYbgT0Pv3T6CoA4 69TQhUDhSc9s6jO6UCI1ldsH09t+3ghrqmc5uayXV8dy0c1PQQbNYKlRl1RMkLg0vZ 3HwsG2mXztYxPWJVMXCbflbuHGXIBIIfEm+lHCgdBE1y1JadM5h0nFCe5lTHzXvGiT EkNun6FjjfEsw==
X-Cc: kuba@kernel.org, willemdebruijn.kernel@gmail.com, davem@davemloft.net, edumazet@kernel.org, pabeni@redhat.com, horms@kernel.org, corbet@lwn.net, skhan@linuxfoundation.org, rdunlap@infradead.org, donald.hunter@gmail.com, andrew+netdev@lunn.ch, shuah@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, willemb@google.com
X-In-Reply-To: <20261116-psp-v4-1-1a599df2aefa@gmail.com>
X-sashiko-severity: Low
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