public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: Paul Chaignon <paul.chaignon@gmail.com>
To: Martin KaFai Lau <martin.lau@linux.dev>
Cc: bpf@vger.kernel.org, Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Eduard Zingerman <eddyz87@gmail.com>,
	Amery Hung <ameryhung@gmail.com>
Subject: Re: [PATCH bpf-next v3 3/5] bpf: Craft non-linear skbs in BPF_PROG_TEST_RUN
Date: Wed, 1 Oct 2025 23:39:45 +0200	[thread overview]
Message-ID: <aN2foao59lLr2RUI@mail.gmail.com> (raw)
In-Reply-To: <85545d76-1177-408e-8224-2fb98ffe8a2f@linux.dev>

On Thu, Sep 18, 2025 at 11:50:22AM -0700, Martin KaFai Lau wrote:
> On 9/18/25 9:47 AM, Paul Chaignon wrote:
> > This patch adds support for crafting non-linear skbs in BPF test runs
> 
> I think it is useful. Thanks for working on it.

Thanks for the review Martin!

> 
> > for tc programs, via a new flag BPF_F_TEST_SKB_NON_LINEAR. When this
> This commit message needs to be updated.
> 
> > flag is set, the size of the linear area is given by ctx->data_end, with
> > a minimum of ETH_HLEN always pulled in the linear area.
> > 
> > This is particularly useful to test support for non-linear skbs in large
> > codebases such as Cilium. We've had multiple bugs in the past few years
> > where we were missing calls to bpf_skb_pull_data(). This support in
> > BPF_PROG_TEST_RUN would allow us to automatically cover this case in our
> > BPF tests.
> > 
> > In addition to the selftests introduced later in the series, this patch
> > was tested by setting BPF_F_TEST_SKB_NON_LINEAR for all tc selftests
> > programs and checking test failures were expected.
> > 
> > Tested-by: syzbot@syzkaller.appspotmail.com> Suggested-by: Daniel Borkmann <daniel@iogearbox.net>
> > Signed-off-by: Paul Chaignon <paul.chaignon@gmail.com>
> > ---
> >   net/bpf/test_run.c | 82 ++++++++++++++++++++++++++++++++++++----------
> >   1 file changed, 65 insertions(+), 17 deletions(-)
> > 
> > diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
> > index 00b12d745479..222a54c24c70 100644
> > --- a/net/bpf/test_run.c
> > +++ b/net/bpf/test_run.c
> > @@ -660,21 +660,30 @@ BTF_ID_FLAGS(func, bpf_kfunc_call_memb_release, KF_RELEASE)
> >   BTF_KFUNCS_END(test_sk_check_kfunc_ids)
> >   static void *bpf_test_init(const union bpf_attr *kattr, u32 user_size,
> > -			   u32 size, u32 headroom, u32 tailroom)
> > +			   u32 size, u32 headroom, u32 tailroom, bool nonlinear)
> 
> test_run_xdp() already has support for multi-frag/buf and doesn't need "bool
> nonlinear". It also does not have the one-page limitation. Is there a reason
> that test_run_skb() cannot follow what the test_run_xdp() does?

You're absolutely right, following the XDP approach made things a lot
simpler. I'm not sure why I was trying to keep all data copy in
bpf_test_init. I've sent a v4 for this. Sorry it took a while to get to
your review.


  reply	other threads:[~2025-10-01 21:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-18 16:45 [PATCH bpf-next v3 0/5] bpf: Support non-linear skbs for BPF_PROG_TEST_RUN Paul Chaignon
2025-09-18 16:46 ` [PATCH bpf-next v3 1/5] bpf: Refactor cleanup of bpf_prog_test_run_skb Paul Chaignon
2025-09-18 16:47 ` [PATCH bpf-next v3 2/5] bpf: Reorder bpf_prog_test_run_skb initialization Paul Chaignon
2025-09-18 16:47 ` [PATCH bpf-next v3 3/5] bpf: Craft non-linear skbs in BPF_PROG_TEST_RUN Paul Chaignon
2025-09-18 18:50   ` Martin KaFai Lau
2025-10-01 21:39     ` Paul Chaignon [this message]
2025-09-18 16:49 ` [PATCH bpf-next v3 4/5] selftests/bpf: Support non-linear flag in test loader Paul Chaignon
2025-09-18 16:51 ` [PATCH bpf-next v3 5/5] selftests/bpf: Test direct packet access on non-linear skbs Paul Chaignon

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=aN2foao59lLr2RUI@mail.gmail.com \
    --to=paul.chaignon@gmail.com \
    --cc=ameryhung@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=martin.lau@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