mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Lina Wang <lina.wang@mediatek.com>,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	bpf@vger.kernel.org, Martin KaFai Lau <kafai@fb.com>,
	Song Liu <songliubraving@fb.com>, Yonghong Song <yhs@fb.com>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>,
	maze@google.com, willemb@google.com, edumazet@google.com
Subject: Re: [PATCH] net: fix wrong network header length
Date: Tue, 08 Feb 2022 09:25:45 +0100	[thread overview]
Message-ID: <0300acca47b10384e6181516f32caddda043f3e4.camel@redhat.com> (raw)
In-Reply-To: <20220208025511.1019-1-lina.wang@mediatek.com>

Hello,

On Tue, 2022-02-08 at 10:55 +0800, Lina Wang wrote:
> When clatd starts with ebpf offloaing, and NETIF_F_GRO_FRAGLIST is enable,
> several skbs are gathered in skb_shinfo(skb)->frag_list. The first skb's
> ipv6 header will be changed to ipv4 after bpf_skb_proto_6_to_4,
> network_header\transport_header\mac_header have been updated as ipv4 acts,
> but other skbs in frag_list didnot update anything, just ipv6 packets.
> 
> udp_queue_rcv_skb will call skb_segment_list to traverse other skbs in
> frag_list and make sure right udp payload is delivered to user space.
> Unfortunately, other skbs in frag_list who are still ipv6 packets are
> updated like the first skb and will have wrong transport header length.
> 
> e.g.before bpf_skb_proto_6_to_4,the first skb and other skbs in frag_list
> has the same network_header(24)& transport_header(64), after
> bpf_skb_proto_6_to_4, ipv6 protocol has been changed to ipv4, the first
> skb's network_header is 44,transport_header is 64, other skbs in frag_list
> didnot change.After skb_segment_list, the other skbs in frag_list has
> different network_header(24) and transport_header(44), so there will be 20
> bytes difference,that is difference between ipv6 header and ipv4 header.

> Actually, there are two solutions to fix it, one is traversing all skbs
> and changing every skb header in bpf_skb_proto_6_to_4, the other is
> modifying frag_list skb's header in skb_segment_list. 

I don't think the above should be addressed into the GSO layer. The
ebpf program is changing the GRO packet in arbitrary way violating the
GSO packet constraint - arguably, it's corrupting the packet.

I think it would be better change the bpf_skb_proto_6_to_4() to
properly handle FRAGLIST GSO packets.

If traversing the segments become too costly, you can try replacing
GRO_FRAGLIST with GRO_UDP_FWD.

Thanks!

Paolo


  reply	other threads:[~2022-02-08  8:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-08  2:55 Lina Wang
2022-02-08  8:25 ` Paolo Abeni [this message]
2022-02-08 12:57   ` Maciej Żenczykowski
2022-02-08 16:01     ` Paolo Abeni
2022-02-10  7:49       ` Steffen Klassert
     [not found]       ` <5ca86c46109794a627e6e2a62b140963217984a0.camel@mediatek.com>
2022-02-10  1:06         ` Jakub Kicinski
2022-02-10 11:56           ` Lina Wang
2022-02-10 16:02         ` Paolo Abeni
2022-02-10 18:06           ` Maciej Żenczykowski
2022-02-11  4:06           ` Lina Wang
2022-02-11  5:54             ` Maciej Żenczykowski
2022-02-16 12:52           ` Lina Wang

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=0300acca47b10384e6181516f32caddda043f3e4.camel@redhat.com \
    --to=pabeni@redhat.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=kpsingh@kernel.org \
    --cc=kuba@kernel.org \
    --cc=lina.wang@mediatek.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=maze@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=songliubraving@fb.com \
    --cc=willemb@google.com \
    --cc=yhs@fb.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

all inboxes | Powered by JetHome®