From: bot+bpf-ci@kernel.org
To: nhudson@akamai.com,bpf@vger.kernel.org
Cc: willemdebruijn.kernel@gmail.com,nhudson@akamai.com,mtottenh@akamai.com,aglasgal@akamai.com,martin.lau@linux.dev,daniel@iogearbox.net,ast@kernel.org,andrii@kernel.org,davem@davemloft.net,edumazet@google.com,kuba@kernel.org,pabeni@redhat.com,netdev@vger.kernel.org,linux-kernel@vger.kernel.org,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,martin.lau@kernel.org,eddyz87@gmail.com,yonghong.song@linux.dev,clm@meta.com,ihor.solodrai@linux.dev
Subject: Re: [PATCH v1 5/5] bpf: clear decap tunnel GSO state in skb_adjust_room
Date: Tue, 17 Mar 2026 13:02:32 +0000 (UTC) [thread overview]
Message-ID: <a4350dcbdc7cf54739156a2cc70d3c6cdeb224bf1df09d996b5bbf409fd6827c@mail.kernel.org> (raw)
In-Reply-To: <20260317121429.2399539-6-nhudson@akamai.com>
[-- Attachment #1: Type: text/plain, Size: 2457 bytes --]
> diff --git a/net/core/filter.c b/net/core/filter.c
> --- a/net/core/filter.c
> +++ b/net/core/filter.c
> @@ -3665,6 +3665,37 @@ static int bpf_skb_net_shrink(struct sk_buff *skb, u32 off, u32 len_diff,
> if (!(flags & BPF_F_ADJ_ROOM_FIXED_GSO))
> skb_increase_gso_size(shinfo, len_diff);
>
> + /* Selective GSO flag clearing based on decap type.
> + * Only clear the flags for the tunnel layer being removed.
> + */
> + if ((flags & BPF_F_ADJ_ROOM_DECAP_L4_UDP) &&
> + (shinfo->gso_type & (SKB_GSO_UDP_TUNNEL |
> + SKB_GSO_UDP_TUNNEL_CSUM)))
> + shinfo->gso_type &= ~(SKB_GSO_UDP_TUNNEL |
> + SKB_GSO_UDP_TUNNEL_CSUM);
Should SKB_GSO_TUNNEL_REMCSUM also be cleared here when decapping
a UDP tunnel?
VXLAN and Geneve set SKB_GSO_TUNNEL_REMCSUM alongside
SKB_GSO_UDP_TUNNEL during encapsulation:
net/ipv4/udp_offload.c:udp_gro_complete():
skb_shinfo(skb)->gso_type |= SKB_GSO_TUNNEL_REMCSUM;
drivers/net/vxlan/vxlan_core.c:vxlan_build_skb():
type |= SKB_GSO_TUNNEL_REMCSUM;
After clearing SKB_GSO_UDP_TUNNEL{,_CSUM} but not TUNNEL_REMCSUM,
the gso_type has an orphaned tunnel flag with no associated tunnel
type.
> +
> + /* Clear encapsulation flag only when no tunnel GSO flags remain */
> + if (flags & BPF_F_ADJ_ROOM_DECAP_MASK) {
> + if (!(shinfo->gso_type & (SKB_GSO_UDP_TUNNEL |
> + SKB_GSO_UDP_TUNNEL_CSUM |
> + SKB_GSO_GRE |
> + SKB_GSO_GRE_CSUM |
> + SKB_GSO_IPXIP4 |
> + SKB_GSO_IPXIP6)))
This check does not include SKB_GSO_TUNNEL_REMCSUM. If a packet
had both SKB_GSO_UDP_TUNNEL and SKB_GSO_TUNNEL_REMCSUM set, the
L4_UDP clearing above removes UDP_TUNNEL but leaves REMCSUM. This
check then concludes no tunnel GSO flags remain and clears
skb->encapsulation, even though a tunnel-related GSO bit is still
present.
The kernel's own UDP tunnel segmentation in
__skb_udp_tunnel_segment() explicitly handles TUNNEL_REMCSUM as
part of tunnel processing:
remcsum = !!(skb_shinfo(skb)->gso_type &
SKB_GSO_TUNNEL_REMCSUM);
Would it make sense to include TUNNEL_REMCSUM in both the L4_UDP
clearing and this encapsulation check?
> + if (skb->encapsulation)
> + skb->encapsulation = 0;
> + }
---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/23194329334
prev parent reply other threads:[~2026-03-17 13:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260317121429.2399539-1-nhudson@akamai.com>
2026-03-17 12:14 ` [PATCH v1 1/5] bpf: name the enum for BPF_FUNC_skb_adjust_room flags Nick Hudson
2026-03-17 12:14 ` [PATCH v1 2/5] bpf: add BPF_F_ADJ_ROOM_DECAP_* flags for tunnel decapsulation Nick Hudson
2026-03-17 12:14 ` [PATCH v1 3/5] bpf: add helper masks for ADJ_ROOM decap flags Nick Hudson
2026-03-17 13:27 ` Willem de Bruijn
2026-03-17 13:47 ` Hudson, Nick
2026-03-17 14:01 ` Willem de Bruijn
2026-03-17 12:14 ` [PATCH v1 4/5] bpf: add guard rails for new DECAP flags Nick Hudson
2026-03-17 13:30 ` Willem de Bruijn
2026-03-17 12:14 ` [PATCH v1 5/5] bpf: clear decap tunnel GSO state in skb_adjust_room Nick Hudson
2026-03-17 13:02 ` bot+bpf-ci [this message]
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=a4350dcbdc7cf54739156a2cc70d3c6cdeb224bf1df09d996b5bbf409fd6827c@mail.kernel.org \
--to=bot+bpf-ci@kernel.org \
--cc=aglasgal@akamai.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=clm@meta.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=eddyz87@gmail.com \
--cc=edumazet@google.com \
--cc=ihor.solodrai@linux.dev \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@kernel.org \
--cc=martin.lau@linux.dev \
--cc=mtottenh@akamai.com \
--cc=netdev@vger.kernel.org \
--cc=nhudson@akamai.com \
--cc=pabeni@redhat.com \
--cc=willemdebruijn.kernel@gmail.com \
--cc=yonghong.song@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
all inboxes | Powered by JetHome®