BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Vladimir Vdovin" <deliran@verdict.gg>
Cc: bpf@vger.kernel.org
Subject: Re: [RFC PATCH bpf-next v1 6/7] veth: support the rx_csum XDP metadata hint
Date: Tue, 30 Jun 2026 19:27:47 +0000	[thread overview]
Message-ID: <20260630192747.9E6711F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260630191510.81402-7-deliran@verdict.gg>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Incorrectly mapping CHECKSUM_PARTIAL to XDP_CSUM_VERIFIED violates the metadata kfunc UAPI and leads to corrupted checksums on forwarded packets.
--

commit 43f8c99f073896fcdca62b5034e71d604e446b2b
Author: Vladimir Vdovin <deliran@verdict.gg>

veth: support the rx_csum XDP metadata hint

This commit implements xmo_rx_csum from skb->ip_summed. It surfaces whatever
checksum verdict the skb already carries, making the metadata kfunc testable
without a NIC since veth has no real hardware.

> diff --git a/drivers/net/veth.c b/drivers/net/veth.c
> index 1c51421491753..b7bc5a3b07e50 100644
> --- a/drivers/net/veth.c
> +++ b/drivers/net/veth.c

[ ... ]

> @@ -1700,6 +1700,28 @@ static int veth_xdp_rx_vlan_tag(const struct xdp_md *ctx, __be16 *vlan_proto,

[ ... ]

> +static int veth_xdp_rx_csum(const struct xdp_md *ctx,
> +			    enum xdp_csum_status *csum_status)
> +{
> +	const struct veth_xdp_buff *_ctx = (void *)ctx;
> +	const struct sk_buff *skb = _ctx->skb;
> +
> +	if (!skb)
> +		return -ENODATA;
> +
> +	/* veth has no real hardware; surface whatever checksum verdict the
> +	 * skb already carries (e.g. CHECKSUM_PARTIAL/UNNECESSARY from a local
> +	 * sender or a previous validation).
> +	 */
> +	if (skb->ip_summed == CHECKSUM_UNNECESSARY ||
> +	    skb->ip_summed == CHECKSUM_PARTIAL)
> +		*csum_status = XDP_CSUM_VERIFIED;

[Severity: High]
Does mapping CHECKSUM_PARTIAL to XDP_CSUM_VERIFIED introduce a regression by
violating the metadata kfunc UAPI? CHECKSUM_PARTIAL indicates that the
payload checksum is incomplete.

If a packet is generated locally and sent over veth, it can carry
skb->ip_summed == CHECKSUM_PARTIAL. If an XDP program reads this metadata
via bpf_xdp_metadata_rx_csum(), it will see XDP_CSUM_VERIFIED. If the
program then forwards the packet out a physical NIC via bpf_redirect(), the
transmitted packet would have an incomplete, invalid checksum on the wire
since only the pseudo-header checksum was computed.

> +	else
> +		*csum_status = XDP_CSUM_NONE;
> +
> +	return 0;
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260630191510.81402-1-deliran@verdict.gg?part=6

  reply	other threads:[~2026-06-30 19:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-30 19:15 [RFC PATCH bpf-next v1 0/7] xdp: RX checksum metadata hint and checksum assertion over redirect Vladimir Vdovin
2026-06-30 19:15 ` [RFC PATCH bpf-next v1 1/7] xdp: let XDP programs assert the RX checksum " Vladimir Vdovin
2026-06-30 19:31   ` sashiko-bot
2026-06-30 19:15 ` [RFC PATCH bpf-next v1 2/7] selftests/bpf: add test for bpf_xdp_assert_rx_csum over cpumap Vladimir Vdovin
2026-06-30 19:27   ` sashiko-bot
2026-06-30 19:15 ` [RFC PATCH bpf-next v1 3/7] xdp: add bpf_xdp_metadata_rx_csum() RX metadata kfunc Vladimir Vdovin
2026-06-30 19:15 ` [RFC PATCH bpf-next v1 4/7] net/mlx5e: support the rx_csum XDP metadata hint Vladimir Vdovin
2026-06-30 19:15 ` [RFC PATCH bpf-next v1 5/7] ice: " Vladimir Vdovin
2026-06-30 19:27   ` sashiko-bot
2026-06-30 19:15 ` [RFC PATCH bpf-next v1 6/7] veth: " Vladimir Vdovin
2026-06-30 19:27   ` sashiko-bot [this message]
2026-06-30 19:15 ` [RFC PATCH bpf-next v1 7/7] selftests/bpf: cover bpf_xdp_metadata_rx_csum in xdp_metadata Vladimir Vdovin
2026-06-30 19:27   ` sashiko-bot
2026-06-30 21:18 ` [RFC PATCH bpf-next v1 0/7] xdp: RX checksum metadata hint and checksum assertion over redirect Stanislav Fomichev
2026-06-30 22:16   ` Lorenzo Bianconi
2026-07-01 17:10     ` Vladimir Vdovin
2026-07-02 14:52       ` Lorenzo Bianconi

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=20260630192747.9E6711F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=deliran@verdict.gg \
    --cc=sashiko-reviews@lists.linux.dev \
    /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