From: sashiko-bot@kernel.org
To: "Todd Freed" <toddfreed@meta.com>
Cc: linux-rdma@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH net-next v3 06/12] net/sched: add act_psp for psp transport mode
Date: Wed, 25 Nov 2026 22:19:41 +0000 [thread overview]
Message-ID: <sashiko-outbox-234241@kernel.org> (raw)
In-Reply-To: <20261124221758.3230929-7-toddfreed@meta.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] net/sched: act_psp: METADATA_PSP dst and skb->decrypted split
on fragmentation
--
commit 8bbfc007284723c55c132cc556b51f47c5d07c71
Author: Todd Freed <toddfreed@meta.com>
net/sched: add act_psp for psp transport mode
This commit adds the act_psp traffic control action to attach a PSP Tx
association as a METADATA_PSP dst on egress (encap) or remove SKB_EXT_PSP
Rx state (decap).
> 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
[ ... ]
> +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:
[ ... ]
> + /* Don't mix the association with another encryption
> + * offload: the packet is already marked decrypted, or its
> + * socket has an offload of its own
> + */
> + if (unlikely(skb_is_decrypted(skb) || tcf_psp_sk_offload(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;
> + case TCA_PSP_ACT_DECAP:
> + /* Only a packet the device decrypted: on transmit,
> + * skb->decrypted means "device, please encrypt", which decap
> + * must not undo.
> + */
> + if (!skb_ext_find(skb, SKB_EXT_PSP))
> + break;
> + skb_ext_del(skb, SKB_EXT_PSP);
> + skb->decrypted = 0;
> + break;
> + }
[Severity: Medium]
Can IP fragmentation split the METADATA_PSP dst from skb->decrypted and
bypass the cleartext drop check in sk_validate_xmit_skb()?
When a packet defragmented by act_ct is encapsulated by TCA_PSP_ACT_ENCAP
and redirected via act_mirred -> tcf_dev_queue_xmit() ->
sch_frag_xmit_hook() -> sch_fragment(), ip_copy_metadata() /
ip6_copy_metadata() and sch_frag_xmit() copy the METADATA_PSP dst onto each
new fragment without copying skb->decrypted:
net/sched/sch_frag.c:sch_frag_xmit() {
...
__skb_dst_copy(skb, data->dst);
*qdisc_skb_cb(skb) = data->cb;
...
}
If a subsequent TC action on the target device replaces or drops the dst,
sk_validate_xmit_skb() sees neither skb_psp_md(skb) nor
skb_is_decrypted(skb) and transmits the fragment in cleartext.
Similarly, ip_copy_metadata() and ip6_copy_metadata() copy SKB_EXT_PSP via
skb_ext_copy() without copying skb->decrypted, so an Rx PSP packet that is
fragmented and later reassembled can enter TCA_PSP_ACT_ENCAP with
SKB_EXT_PSP still attached and skb->decrypted == 0; if TCA_PSP_ACT_DECAP
then runs, it finds SKB_EXT_PSP and clears skb->decrypted = 0 while leaving
the METADATA_PSP dst attached.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261124221758.3230929-1-toddfreed@meta.com?part=6
next prev parent reply other threads:[~2026-11-25 22:19 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 22:17 [PATCH net-next v3 00/12] psp: introduce socket-less associations Todd Freed
2026-11-24 22:17 ` [PATCH net-next v3 01/12] psp: get netns from net_device instead of sock Todd Freed
2026-11-24 22:17 ` [PATCH net-next v3 02/12] psp: take the psp nexthdr from the packet on encap Todd Freed
2026-11-24 22:17 ` [PATCH net-next v3 03/12] psp: declare psp_assoc_set_tx() in psp.h Todd Freed
2026-11-24 22:17 ` [PATCH net-next v3 04/12] psp: add support for socket-less psp associations Todd Freed
2026-11-24 22:17 ` [PATCH net-next v3 05/12] net: add METADATA_PSP dst to carry a psp association on an skb Todd Freed
2026-11-25 22:19 ` sashiko-bot
2026-11-24 22:17 ` [PATCH net-next v3 06/12] net/sched: add act_psp for psp transport mode Todd Freed
2026-11-25 22:19 ` sashiko-bot [this message]
2026-11-24 22:17 ` [PATCH net-next v3 07/12] net/sched: flower: add psp_spi, psp_ver, and psp_dev matches Todd Freed
2026-11-24 22:17 ` [PATCH net-next v3 08/12] selftests: drv-net: psp: test socket-less associations and the tc psp action Todd Freed
2026-11-24 22:17 ` [PATCH net-next v3 09/12] selftests: drv-net: psp: test that software encap on ingress drops Todd Freed
2026-11-24 22:17 ` [PATCH net-next v3 10/12] selftests: tc-testing: run dependsOn probes outside the test namespace Todd Freed
2026-11-24 22:17 ` [PATCH net-next v3 11/12] selftests: tc-testing: add tests for the psp action Todd Freed
2026-11-24 22:17 ` [PATCH net-next v3 12/12] Documentation: networking: psp: document socket-less associations Todd Freed
2026-11-25 22:19 ` [PATCH net-next v3 00/12] psp: introduce " sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-234241@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=toddfreed@meta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox