BPF List
 help / color / mirror / Atom feed
From: Jakub Sitnicki <jakub@cloudflare.com>
To: Jiayuan Chen <mrpre@163.com>, John Fastabend <john.fastabend@gmail.com>
Cc: bpf@vger.kernel.org,  martin.lau@linux.dev,  ast@kernel.org,
	edumazet@google.com,  davem@davemloft.net,  dsahern@kernel.org,
	kuba@kernel.org,  pabeni@redhat.com,
	 linux-kernel@vger.kernel.org, song@kernel.org,
	 andrii@kernel.org,  mhal@rbox.co, yonghong.song@linux.dev,
	 daniel@iogearbox.net, xiyou.wangcong@gmail.com,
	 horms@kernel.org
Subject: Re: [PATCH bpf v3 1/2] bpf: fix wrong copied_seq calculation
Date: Mon, 23 Dec 2024 21:57:22 +0100	[thread overview]
Message-ID: <87h66ujex9.fsf@cloudflare.com> (raw)
In-Reply-To: <ojwjcubviyjxpucryc3ypi4b77h5f5g6ouv7ovaljah5harfyj@jue7hqit2t5n> (Jiayuan Chen's message of "Thu, 19 Dec 2024 17:30:53 +0800")

On Thu, Dec 19, 2024 at 05:30 PM +08, Jiayuan Chen wrote:
> Currently, not all modules using strparser have issues with
> copied_seq miscalculation. The issue exists mainly with
> bpf::sockmap + strparser because bpf::sockmap implements a
> proprietary read interface for user-land: tcp_bpf_recvmsg_parser().
>
> Both this and strp_recv->tcp_read_sock update copied_seq, leading
> to errors.
>
> This is why I rewrote the tcp_read_sock() interface specifically for
> bpf::sockmap.

All right. Looks like reusing read_skb is not going to pan out.

But I think we should not give up just yet. It's easy to add new code.

We can try to break up and parametrize tcp_read_sock - if other
maintainers are not against it. Does something like this work for you?

  https://github.com/jsitnicki/linux/commits/review/stp-copied_seq/idea-2/

Other minor feedback I have:

- The newly added code is optional and should depend on
  CONFIG_BPF_STREAM_PARSER being enabled. Please check that it builds
  with CONFIG_BPF_STREAM_PARSER=n as well.

- Let's not add complexity until it's really needed, and today we don't
  need seprate tcp_bpf_proto_ops for IPv4 and IPv6.

- There are style issues with the added test. Please run checkpatch.pl.

  parent reply	other threads:[~2024-12-23 20:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-18  5:34 [PATCH bpf v3 0/2] bpf: fix wrong copied_seq calculation and add tests Jiayuan Chen
2024-12-18  5:34 ` [PATCH bpf v3 1/2] bpf: fix wrong copied_seq calculation Jiayuan Chen
2024-12-18 15:35   ` Jakub Sitnicki
2024-12-19  9:30     ` Jiayuan Chen
2024-12-20  7:06       ` John Fastabend
2024-12-23 20:57       ` Jakub Sitnicki [this message]
2024-12-23 22:57         ` Jakub Sitnicki
2024-12-24  7:16           ` Jiayuan Chen
2024-12-27 14:09             ` Jakub Sitnicki
2024-12-18  5:34 ` [PATCH bpf v3 2/2] selftests/bpf: add strparser test for bpf Jiayuan Chen

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=87h66ujex9.fsf@cloudflare.com \
    --to=jakub@cloudflare.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=mhal@rbox.co \
    --cc=mrpre@163.com \
    --cc=pabeni@redhat.com \
    --cc=song@kernel.org \
    --cc=xiyou.wangcong@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