From: sashiko-bot@kernel.org
To: "Todd Freed" <toddfreed@meta.com>
Cc: bpf@vger.kernel.org, linux-rdma@vger.kernel.org
Subject: Re: [PATCH net-next v1 02/15] psp: take the psp nexthdr from the packet on encap
Date: Thu, 12 Nov 2026 00:56:59 +0000 [thread overview]
Message-ID: <sashiko-outbox-210005@kernel.org> (raw)
In-Reply-To: <20261111005533.6436-3-toddfreed@meta.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] mlx5e: psp software GSO on tunneled skbs bypasses
psp_dev_encap_ok()
--
commit 1d6df14f6316e027ee333bf0c262d7f9842ccd5c
Author: Todd Freed <toddfreed@meta.com>
psp: take the psp nexthdr from the packet on encap
This commit populates the PSP next header from the original IP header in
psp_dev_encapsulate() instead of hardcoding IPPROTO_TCP, rejects packets
that cannot be encapsulated (IPv6 extension headers, IPv4 fragments, and
already-encapsulated packets), and updates mlx5e_features_check() to fall
back to software GSO and checksumming for unsupported protocols.
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> index c3c2c5720c6f3..d091de1a5992b 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
[ ... ]
> @@ -5140,6 +5157,22 @@ netdev_features_t mlx5e_features_check(struct sk_buff *skb,
>
> features = vlan_features_check(skb, features);
>
> + /* The PSP tx path fixes up the TCP checksum of a GSO skb for the
> + * device, which is only valid for TCP, and the device only completes
> + * a TCP or UDP checksum behind the PSP header. Have the stack segment
> + * and checksum other skbs.
> + */
> + if ((skb_is_gso(skb) || skb->ip_summed == CHECKSUM_PARTIAL) &&
> + mlx5e_psp_is_offload(skb, netdev)) {
> + if (skb_is_gso(skb) &&
> + !(skb_shinfo(skb)->gso_type &
> + (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)))
> + features &= ~NETIF_F_GSO_MASK;
> + if (skb->ip_summed == CHECKSUM_PARTIAL &&
> + !mlx5e_psp_l4_csum_ok(skb))
> + features &= ~NETIF_F_CSUM_MASK;
> + }
[Severity: Medium]
Can clearing NETIF_F_CSUM_MASK and NETIF_F_GSO_MASK on an already
encapsulated GSO skb (skb->encapsulation == 1) cause software tunnel GSO
to strip skb->encapsulation and bypass the check in psp_dev_encap_ok()?
For a PSP-offloaded GSO packet encapsulated in a tunnel such as GRE,
mlx5e_psp_l4_csum_ok() sees IPPROTO_GRE and clears NETIF_F_CSUM_MASK,
which also clears NETIF_F_GSO_MASK in harmonize_features().
validate_xmit_skb() then runs software tunnel GSO (gre_gso_segment()),
which completes the inner checksums in software, leaves seg->encapsulation
as 0, points seg->transport_header at the outer GRE header right after the
outer IP header, and for SKB_GSO_GRE_CSUM sets seg->ip_summed to
CHECKSUM_PARTIAL.
When those segments reach mlx5e_psp_handle_tx_skb() ->
psp_dev_encapsulate(), psp_dev_encap_ok() sees seg->encapsulation == 0 and
network_len == ip_hdrlen(seg), so it encapsulates the outer GRE packet
with nexthdr = IPPROTO_GRE instead of dropping it. In the mlx5e TX path,
mlx5e_psp_set_swp() leaves eseg->swp_inner_l4_offset as 0 for IPPROTO_GRE
while mlx5e_psp_txwqe_build_eseg_csum() still sets
MLX5_ETH_WQE_L4_INNER_CSUM because seg->ip_summed == CHECKSUM_PARTIAL,
producing corrupted frames or hardware TX descriptor syndromes.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261111005533.6436-1-toddfreed@meta.com?part=2
next prev parent reply other threads:[~2026-11-12 0:56 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 0:55 [PATCH net-next v1 00/15] psp: introduce socket-less associations Todd Freed
2026-11-11 0:55 ` [PATCH net-next v1 01/15] psp: get netns from net_device instead of sock Todd Freed
2026-11-11 0:55 ` [PATCH net-next v1 02/15] psp: take the psp nexthdr from the packet on encap Todd Freed
2026-11-12 0:56 ` sashiko-bot [this message]
2026-11-11 0:55 ` [PATCH net-next v1 03/15] psp: declare psp_assoc_set_tx() in psp.h Todd Freed
2026-11-11 0:55 ` [PATCH net-next v1 04/15] psp: add support for socket-less psp associations Todd Freed
2026-11-11 16:49 ` Daniel Zahka
2026-11-11 18:23 ` Todd Bert Freed
2026-11-11 19:01 ` Daniel Zahka
2026-11-11 21:49 ` Todd Bert Freed
2026-11-12 0:51 ` Todd Bert Freed
2026-11-11 0:55 ` [PATCH net-next v1 05/15] net: add METADATA_PSP dst to carry a psp association on an skb Todd Freed
2026-11-12 0:57 ` sashiko-bot
2026-11-11 0:55 ` [PATCH net-next v1 06/15] net/sched: act_mirred: don't send decrypted skbs from egress to ingress Todd Freed
2026-11-11 0:55 ` [PATCH net-next v1 07/15] bpf: don't redirect " Todd Freed
2026-11-12 0:57 ` sashiko-bot
2026-11-11 0:55 ` [PATCH net-next v1 08/15] psp: only give time-wait sockets of psp connections a validator Todd Freed
2026-11-11 11:37 ` Daniel Zahka
2026-11-11 0:55 ` [PATCH net-next v1 09/15] net/sched: add act_psp for psp transport mode Todd Freed
2026-11-12 0:57 ` sashiko-bot
2026-11-11 0:55 ` [PATCH net-next v1 10/15] net/sched: flower: add psp_spi, psp_ver, and psp_dev matches Todd Freed
2026-11-11 0:55 ` [PATCH net-next v1 11/15] selftests: drv-net: psp: test socket-less associations and the tc psp action Todd Freed
2026-11-12 0:57 ` sashiko-bot
2026-11-11 0:55 ` [PATCH net-next v1 12/15] selftests: drv-net: psp: test that software encap on ingress drops Todd Freed
2026-11-11 0:55 ` [PATCH net-next v1 13/15] selftests: tc-testing: run dependsOn probes outside the test namespace Todd Freed
2026-11-12 0:57 ` sashiko-bot
2026-11-11 0:55 ` [PATCH net-next v1 14/15] selftests: tc-testing: add tests for the psp action Todd Freed
2026-11-11 0:55 ` [PATCH net-next v1 15/15] Documentation: networking: psp: document socket-less associations Todd Freed
2026-11-11 17:01 ` [PATCH net-next v1 00/15] psp: introduce " Daniel Zahka
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-210005@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