Article View: linux.kernel.netdev
Article #23997Re: [PATCH net-next v3 06/12] net/sched: add act_psp for psp transport mode
From: netdev-bot+sashiko
Date: Sat, 28 Nov 2026 23:57
Date: Sat, 28 Nov 2026 23:57
214 lines
16624 bytes
16624 bytes
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 2 · Low: 1
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] Encap marks arbitrary egress packets as device-decrypted, and
a later egress-to-ingress redirect delivers them locally with the mark…
- [Medium] net/sched: act_psp: METADATA_PSP dst and skb->decrypted split
on fragmentation
- [Low] The help text for NET_ACT_PSP in net/sched/Kconfig says the
action 'Enables transparent psp tunnels for forwarded traffic.' The…
--
net/sched: add act_psp for psp transport mode
This commit adds a new tc action, act_psp, for PSP transport mode. Encap
attaches a PSP Tx association to an egress skb as a METADATA_PSP dst and
sets skb->decrypted, so the PSP device encrypts the packet on transmit.
Decap removes the PSP Rx state from a packet the device decrypted.
> diff --git a/net/sched/Kconfig b/net/sched/Kconfig
> index 6ddff028b81a4..35f9d76c4caea 100644
> --- a/net/sched/Kconfig
> +++ b/net/sched/Kconfig
> @@ -939,6 +939,19 @@ config NET_ACT_GATE
> To compile this code as a module, choose M here: the
> module will be called act_gate.
>
> +config NET_ACT_PSP
> + tristate "PSP encryption tc action"
> + depends on NET_CLS_ACT && INET_PSP
> + help
> + Say Y here to allow PSP associations, created through the PSP
> + netlink family, to be attached to packets. PSP capable devices can
> + then encrypt them on transmit. Enables transparent psp tunnels for
> + forwarded traffic.
[Severity: Low]
This isn't a bug, but is "transparent psp tunnels" accurate in the
NET_ACT_PSP help text?
The action only implements PSP transport mode. It inserts UDP + PSP
between L3 and L4, and tcf_psp_set_transport_header() rejects fragments
and IPv6 extension headers. The commit message also says "Tunnel mode
PSP, which a later series adds".
The help text is still the same at the end of the series.
[ ... ]
> diff --git a/net/sched/act_psp.c b/net/sched/act_psp.c
> new file mode 100644
> index 0000000000000..757b15a812a20
> --- /dev/null
> +++ b/net/sched/act_psp.c
> @@ -0,0 +1,437 @@
[ ... ]
> +static int tcf_psp_act(struct sk_buff *skb, const struct tc_action *a,
> + struct tcf_result *res)
> +{
> + struct tcf_psp *p = to_psp(a);
> + struct tcf_psp_params *params;
> +
> + params = rcu_dereference_bh(p->params);
> +
> + tcf_lastuse_update(&p->tcf_tm);
> + tcf_action_update_bstats(&p->common, skb);
> +
> + switch (params->psp_action) {
> + case TCA_PSP_ACT_ENCAP:
> + /* Encap on ingress isn't supported: routing replaces the
> + * dst of a packet entering the stack, so it would lose its
> + * association before it reaches the PSP device
> + */
> + if (unlikely(skb_at_tc_ingress(skb)))
> + return tcf_psp_drop(p, skb, SKB_DROP_REASON_PSP_OUTPUT);
[ ... ]
> + if (unlikely(!tcf_psp_set_transport_header(skb)))
> + return tcf_psp_drop(p, skb, SKB_DROP_REASON_PSP_OUTPUT);
> + skb_dst_drop(skb);
> + skb_dst_set(skb, dst_clone(¶ms->md->dst));
> + /* Must be encrypted: sk_validate_xmit_skb() drops it unless
> + * it still carries the association when it is transmitted
> + */
> + skb->decrypted = 1;
> + break;
[Severity: Medium]
Can the METADATA_PSP dst and skb->decrypted come apart after
tcf_psp_act() has paired them here?
The backstop in this comment only works if both stay together, but the
fragmentation paths copy only one of them.
Suppose act_ct defragmented the packet earlier, so
tc_skb_cb(skb)->mru is set. A later mirred redirect then goes through
tcf_dev_queue_xmit() -> sch_frag_xmit_hook() -> sch_fragment().
ip_do_fragment() and ip6_fragment() build the fragments with
ip_copy_metadata() / ip6_copy_metadata(). Those copy the dst and the
skb extensions, but not skb->decrypted. sch_frag_xmit() then puts the
saved METADATA_PSP dst back on each fragment with __skb_dst_copy().
Nothing on that path rejects an skb with decrypted set.
The new fragments carry the association with decrypted == 0. A later
rule on the target device might drop or replace the dst, for example
an egress-to-ingress mirred followed by forwarding, or tunnel_key set.
sk_validate_xmit_skb() then sees neither skb_psp_md() nor
skb_is_decrypted(), and sends the fragment in cleartext instead of
dropping it.
This action can also reach the same state a second way.
ip_copy_metadata() copies SKB_EXT_PSP without decrypted too, so a
fragmented Rx PSP packet can arrive with SKB_EXT_PSP and
decrypted == 0:
- Encap only checks skb_is_decrypted(), not
skb_ext_find(skb, SKB_EXT_PSP), so it accepts the packet and sets
decrypted.
- A decap later in the pipeline sees SKB_EXT_PSP, deletes it and
clears skb->decrypted. It doesn't check whether skb_psp_md(skb)
is set.
That again leaves the METADATA_PSP dst with decrypted == 0.
Should encap refuse skbs that carry SKB_EXT_PSP, and should decap leave
skb->decrypted alone when the skb has a PSP metadata dst?
For the fragmentation case, which fix do you prefer? Encap could drop
packets that sch_frag will refragment (tc_skb_cb(skb)->mru set), since
transport mode can't encrypt fragments anyway. Or the fragment paths
could carry skb->decrypted over.
Reaching this needs CAP_NET_ADMIN and a specific pipeline: act_ct
defrag, psp encap, mirred, then a step that drops the dst. Still, the
commit message says skb->decrypted is set so that a packet losing its
association gets dropped, and these paths get around that. The code is
still the same at the end of the series.
[Severity: Medium]
Can a later action in the same rule move this skb to ingress with
skb->decrypted still set?
tcf_psp_act() returns params->action, which can be TC_ACT_PIPE. The
only direction check is skb_at_tc_ingress(), done before encap.
With mirred ingress redirect after encap, tcf_mirred_to_dev() clones the
skb. The clone keeps the decrypted bit. It then drops the dst:
net/sched/act_mirred.c:tcf_mirred_to_dev() {
...
if (want_ingress && !at_ingress) /* drop dst for egress -> ingress */
skb_dst_drop(skb_to_send);
...
}
That removes the METADATA_PSP association, and tcf_mirred_forward() then
calls netif_rx().
Neither sk_validate_xmit_skb() nor psp_xmit_md() runs on that path, and
nothing on the receive side clears skb->decrypted.
The skb then reaches TCP with decrypted set. On a kTLS socket using
TLS_HW RX offload:
net/tls/tls_device.c:tls_device_decrypted() {
...
if (!tls_strp_msg_mixed_decrypted(sw_ctx)) {
is_decrypted = skb->decrypted;
is_encrypted = !is_decrypted;
...
}
Would the record then count as already decrypted and authenticated by
the NIC, so software decryption and tag verification are skipped? If so,
plaintext chosen by whoever controls the tc rule would be accepted as
genuine TLS record data. That plaintext could be a frame built with
AF_PACKET or rewritten with pedit.
The commit message says "Any other device drops it" and that
"sk_validate_xmit_skb() drops the packet if it loses the METADATA_PSP
dst on the way". Neither holds for a redirect to ingress.
A later patch in the series, Documentation/networking/psp.rst, says such
a packet is "delivered locally with skb->decrypted still set" and calls
this unsupported. The kernel still doesn't prevent it, and the document
doesn't cover the kTLS impact. The code is still the same at the end of
the series.
Reaching this needs all of the following:
- CAP_NET_ADMIN in the netns.
- A PSP association that the netns can access.
- PSP hardware.
- A kTLS HW RX socket in the same netns.
PSP sockets don't seem affected, because their Rx policy also requires
SKB_EXT_PSP, and the forged skb doesn't have it.
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261124221758.3230929-1-toddfreed%40meta.com
Technical Details
Message-ID:
<179591022206.3135.561641643662591036@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder2.feed.ams11.usenet.farm!feeder4.usenet.farm!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-373292-linux-kernel-netdev=dewy.ruReferences:
<20261124221758.3230929-7-toddfreed@meta.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder2.feed.ams11.usenet.farm!feeder4.usenet.farm!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-373292-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v3 06/12] net/sched: add act_psp for psp transport mode Date: Sat, 28 Nov 2026 23:57:02 +0000 Organization: Usenet Network Message-ID: <179591022206.3135.561641643662591036@kernel.org> References: <20261124221758.3230929-7-toddfreed@meta.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1062268"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:BTGXJe3Lp0ApizFvbI/u9rdSbsQ= sha256:ws+SBfeOZpsJvs+gxUXfhdav0PhF1Oc/PnL3d8wzfbY= sha1:qOrCELgP8CQTEwqhYseS8sju58I= sha256:uC17dO+Eoa9we3vPUVI5RMQruS7HOt+If8IyYD2kQ+g= 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 84016125F92; Sun, 29 Nov 2026 02:57:27 +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 y-SJ43GmgUlz; Sun, 29 Nov 2026 02:57:23 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-373292-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 5A3F7125F8D; Sun, 29 Nov 2026 02:57:14 +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 2EBA9278B1; Sat, 28 Nov 2026 23:57:07 +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=1795910226; b=nxirLjQlW9u6EXSlP3ZEhQbDWoybEm66oe470vUUYK0ghYOj5NGgEozd0UUQN2/S7cz3 iqnCD6K42Fs8GNnujjlciGmkgo5VZunQvXDME4ID5A4Uqd+T4X94stCGiqUxSki8yvUhV MUX05f34Y3juYOFWMFq29SNCPuoY3uQr+9g7W/FB9bZGibW2OF1SoXTYMEgbtnySpbdAX LsRIt/NqCvjoYmh7885gEqI09xS9Pyix4/Bg1xHl6dSgmceGa4gbMbpcDsEOOksRYvLPi QL+zMvdl76BrefrvtnU4Y92nkS9WuySjJR/ucw7Iypm+EQXdfjWUMbsDxgCdkHE5jUg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795910226; 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=KhnZCrhnqex0WIv0p/EuTJujf5qpPjuUlIroKHGzHQU=; b=OI8NF2e9iN4rTnFlkYmsamOunSofzRyEbVlrbHJfOMPClSSvHFRpYo/MWTY1nJhi5I96 xP72g/UD6wPOofPO2VigcP/u2GXDUl7xlb8U/H9bVIo1UDMX0ll/c0/bldIZResW1lRZG I/+1zSrSGIMSxG4MkmY6RXCxXHa5bu+Cf+qzMitkudqoajjjeIMHP4uXXdtPrkJLEVq45 sdXinPu8FvwR//2x2LL6vPAATWi7KW69NxBmcs7twLf1fE19b+QZw5MW+jy50Rmz9oSdl f4gC0+tBPmx73VVipy78zRz0IaOUAhuGcnFOcnB0PVIFxFy2cjaw1T8mqg1RUF/zLHQ== 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=HvJFuQ7v; 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 EDD37606A33F; Sat, 28 Nov 2026 23:57: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=HvJFuQ7v 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=1795910225; b=g+wSnZHAcftuMrqtudZBkjJ+oNFDVt/WslwzQrJJE/w0uehnz3cXmVXw19WcdLdkeQ/S TmdiCwchiQVPnJTHpFjZUOpV6ckNjRTWtySdmNXjhovQ4FHZZL28fiUddAXS7MDMEQv/C fJfjDTCFwd4tTZ7hKLZ4/vtR0giZACNcEij8nfFTuhrRYS6EyICnADoq4C5+fH32fUjar 9otJDIuj59FiyUYkWCJzZu8/helDQLxiW56y5NHZkleF6yJ9wyV5xHT6ZG+eSZyz0Gbsg N8Od6yejFKNxgFkJnX/xp8GbwNdyuifnlVuGknJsmQgyu3Wy+EngAUdWyN/7mZqRw/A== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795910225; 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=KhnZCrhnqex0WIv0p/EuTJujf5qpPjuUlIroKHGzHQU=; b=UX9oMSrUeQMzW890iF/UZQNDCn8/dxbyWmyzL0j6Q3fzmKJNSIvy16LUv0SXwDbki6gF v10IU3LGnPypHzEFQmgw9l/hS4uReMGm3KxOaUR8nNlWNKMdXJ+cTd7+E6Ll9J3nhCktV yfmX0nu3GZwpPB3HdLiXkxvH55F5kSnm2efSA9otLOWSd45MdnAkz1v574c/4ZvKPbStq EOpoNdqBdl5DFUzlU0kUwe0BUYnKRWXClPN0Bz0ibkz/sq5f1ILm6HSSIbU2HLx6kMm2R Ox5Hac/GpKmqUCAhciL/6C1V2UVrcn8ljfg3nTTephoo3y0fqdlKCQoGKmj11eGS89g== 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=HvJFuQ7v; 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 18182606A330; Sat, 28 Nov 2026 23:57:04 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8572B1F000C1; Sat, 28 Nov 2026 23:57:02 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795910224; bh=KhnZCrhnqex0WIv0p/EuTJujf5qpPjuUlIroKHGzHQU=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=HvJFuQ7vxBx1s8G5UhKuxaz658eqUdes1V5lHvFNr3mxQ81l9rJj5/gjhYA/FzIuR gzLHgfBnIck63k8Baaf0u4vIcUPBpfGrFrRDNTCruP02l4zfcTIPaOUx/CAbU2xdbS FVP7EkoFJqv+D6lPorUx/daLwJEbm77d8S/Mg1Rrw11EmVUNR0z2OHROFVSCcSpNwm 7EfJvqrzQvRDwTJ5RjBm2oSzIX0Ofw4Ur9Q5hvesjVSgLVu7njUfDsNItu9TlaZfP6 kh0YwUuZYfvWLve+mIcR+g7i6WHy/l1IS5yu9Fww2PefRkqHqBU939yw8O5fdcnrEF KcMrvosqj6FwA== 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-7-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