๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #23996

Re: [PATCH net-next v3 05/12] net: add METADATA_PSP dst to carry a psp association on an skb

#23996
From: netdev-bot+sashiko
Date: Sat, 28 Nov 2026 23:56
81 lines
11348 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] Concern: in this commit nothing sets skb->decrypted on socket-
  less METADATA_PSP packets, and the psp_md_alloc() kerneldoc does notโ€ฆ

--

net: add METADATA_PSP dst to carry a psp association on an skb

This commit adds a METADATA_PSP metadata_dst type that holds a reference
on a PSP association, so that an association can be attached to an skb
without a socket. psp_skb_get_assoc_rcu() now checks for it first.
__dev_queue_xmit() and sk_validate_xmit_skb() drop such packets if they
are on the wrong device or too big for the MTU.

> diff --git a/net/psp/psp_main.c b/net/psp/psp_main.c
> index 8f669304a9969..7c5291d5e9712 100644
> --- a/net/psp/psp_main.c
> +++ b/net/psp/psp_main.c
> @@ -217,6 +217,37 @@ unsigned int psp_key_size(u32 version)

[ ... ]

> +/**
> + * psp_md_alloc() - allocate a METADATA_PSP dst for an association
> + * @pas: association, the dst takes over the caller's reference on success
> + *
> + * Context: process context, may sleep.
> + * Return: the dst, or NULL on failure.
> + */
> +struct metadata_dst *psp_md_alloc(struct psp_assoc *pas)

[Severity: Low]
Should this kerneldoc say that whoever attaches the dst must also set
skb->decrypted?

In this commit nothing sets skb->decrypted on socket-less METADATA_PSP
packets. psp_skb_get_assoc_rcu() also returns the md association without
checking skb->decrypted.

Suppose the METADATA_PSP dst is lost after it is attached, for example
because a later action replaces the dst. sk_validate_xmit_skb() would then
skip the skb_psp_md() branch. It would also skip the fail-closed branch,
because that branch only runs when skb->decrypted is set:

    } else if (unlikely(skb_is_decrypted(skb))) {
        pr_warn_ratelimited("unencrypted skb with no associated socket - dropping\n");

In that case the packet would go out in clear text.

As far as I can tell, this is handled later in the series. In
"net/sched: add act_psp for psp transport mode", the encap path of
tcf_psp_act() does:

    skb_dst_set(skb, dst_clone(&params->md->dst));
    ...
    skb->decrypted = 1;

That is currently the only caller of psp_md_alloc(). INET_PSP selects
SKB_DECRYPTED and SOCK_VALIDATE_XMIT, so the drop path is always built in.

Given that, there is no runtime effect. Could the psp_md_alloc() kerneldoc
state the skb->decrypted rule, so that future callers keep this
fail-closed behaviour?

> +{
> +	struct metadata_dst *md;
> +
> +	if (!static_branch_inc(&psp_md_needed.key))
> +		return NULL;
> +	md = metadata_dst_alloc(0, METADATA_PSP, GFP_KERNEL);

[ ... ]

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261124221758.3230929-1-toddfreed%40meta.com
Technical Details
Message-ID: <179591021919.3135.12606485020589214608@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-373291-linux-kernel-netdev=dewy.ru
References: <20261124221758.3230929-6-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-373291-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v3 05/12] net: add METADATA_PSP dst to carry a
 psp association on an skb
Date: Sat, 28 Nov 2026 23:56:59 +0000
Organization: Usenet Network
Message-ID: <179591021919.3135.12606485020589214608@kernel.org>
References: <20261124221758.3230929-6-toddfreed@meta.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1062199"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:fShPTVmJszSfBn8as16ySIOZJz0= sha256:0Vw1YwsI3muGNFULXhGPAPmPiPrwPoRmx8drlev/h0M=
	sha1:It4uedmerffwefHg9FMgkA6owSI= sha256:lCBQqiYTwAxsqiL7rOFYXt8nMpj8LUUCCSEg0JylOLI=
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 362CF125F90; Sun, 29 Nov 2026 02:57:21 +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 US4oytAgEqVk;
	Sun, 29 Nov 2026 02:57:17 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-373291-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 9C0C6125F88; Sun, 29 Nov 2026 02:57:07 +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 43DDD27165; Sat, 28 Nov 2026 23:57:04 +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=1795910223;
	b=iXUgcqJ43HqB/uATIUz8S5LcL0mkjOINguyyjbj2ozZpJ5ap2ndh1Nb0gqNScNGZKvYU
	 QhzfuR4Y0AZHsHTembv4Elm9iWcGHI96YQ4xBa3yN5PTHDrxKxHmsEfrkfnRgD4c5xfwX
	 Sl9cPwdOV37/hb34o3K+AuwP6ruUllI4DQPPxB5sjgD3JydoT1QzxTrtcVwAj2B0uMNkt
	 GXGxIZ5ox4dsPV0gi2Q+3xelSQKJvAFcnw513unfrKFnlU5cDiPSJlsotS6Uv7do1fLJ/
	 1niUCVW3NpBPL+JJPBP9Whr2RkU43ICnxbjePz7zIBW5FNE2Q0zcOrX7kYVKc7Rt+8g==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795910223;
	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=8aaeBQp0/hPjhQAy/1Hp7rBN4MN9WESHeXU1oFId7cI=;
	b=xN3hJoPIu6+K3IrZ7D91a1UQOtkkVlkUW7SdfICTM3Cvk/TiMO+k3hh3dQw5CRBIU+yH
	 25ae2FmDkZ7YISS/LK+ChDNXFgWU3h630HCb4E3QBpHrV0rvAdHvC/g5Os43cZzyR/u6/
	 NdbRvy1n4lZbWjGJs1zWhVuDVajSQsZ7rqU+kIybpFirj5f6cO7GsgE2GdFLR5gg+Acva
	 jrXTSEYcw11kYS4xwCFuor89L92avTAi64PdPBdBuDxyK61IvuWIYZRbioTaRsxrfMuLc
	 TBUBQw8V8iocQZg7/kSk65PnpjdUen/65lFGJthMhkDjPOz6U/xPLF/R4DAJAvhqSzg==
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=Mz9kjnCo;
	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 1D9D8606A336;
	Sat, 28 Nov 2026 23:57:03 +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=Mz9kjnCo
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=1795910222;
	b=qlDNdu3g+dwh3DkFdrfuQBx8/dIBut4L5Qdcg6eil8wk63vImu4veHVlBJJrBzJN+xHI
	 Y1FO33RUS22JjYnmalJGTXkrQfcSPhBMvyMROcO88Vkk//1GghrWNkGKIlS9Wupahyy5E
	 azrLefPVvC9aLsvUxg9H30TwEdHUU91jASGfhcVX+jfb3/fV2MSBrG9ssq8us4GAG8Wkr
	 RcXOLlXWZLp89cw/lQPjSMoTRzcLDK1VeJxoYMG+Mgvu0lAqNQggf8JnBPx0ASXwCwZjO
	 D4zBKfGMVlzA7AVNG8oGI5BSTjET6noBxVJppxQ8Ty5GwNhlWyshBgFHQB6mzmsUvGA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795910222;
	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=8aaeBQp0/hPjhQAy/1Hp7rBN4MN9WESHeXU1oFId7cI=;
	b=e5C6dK+/y/s+lIlQn8itIV1k75fklDTN+/NoI0TvAsgh+AAJV4PHYeuvJGYQE8Uwy6tS
	 Lj9XFmtdkXRQMBAcsGUZIVhj/pGcgH1+6ux4IXp/if7k2b8xZalWv59obi8knB5z6gWbe
	 QeUhsqIz+vr3Yso2r10ePNeH+JrGoAuVDOh9QoSoSsn3iKV6nXjtY+zCKiW2hFQ1Hdefk
	 noYajbi3lqhGvgATmfr0FJh3vme8kTX9DItdiqv6jJL2J7EYlgyWtH3oXG+dZN1vCzpXR
	 mnpDSMc191Oyxe2tnr60pIN2RJ/E5wbth+/AcAwILyl8MzKNOd33jyvgiL2OSkzxZlQ==
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=Mz9kjnCo;
	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 3A2FF606A31C;
	Sat, 28 Nov 2026 23:57:02 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1F791F000C1;
	Sat, 28 Nov 2026 23:56:59 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795910221;
	bh=8aaeBQp0/hPjhQAy/1Hp7rBN4MN9WESHeXU1oFId7cI=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=Mz9kjnCoefGR1QRA8bojRFQcXlx+2dU+u9slbcRzH6E1Hf9CyXSyhXePNmBQBAltn
	 Z+sjPCMb1hR2vnR8l7w8PzS/2WyM042r7Udc+vABqmzqWBIL2oqXiAHQ5GoOiXm0LK
	 NCcrlMxWwLhlmzkrV5aWWTJDNy/53m1Ed9pIebjkbTGvpGs/JPcBVk9EE3XL9IYDYS
	 sFs5A4FfVqejbojgkYtN14a7KivQCldChMygqRI4l+kkPQxBw++gHToMEGK/OKsqQe
	 cl17fy/5kcX32TcYYVX1301Ixwf6mWWue9LLyuyTO4EGgreXyA4NV5IZoNOFNazje/
	 9HdoPaD05hGoA==
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-6-toddfreed@meta.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