public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next v5 0/5] Support non-linear skbs for BPF_PROG_TEST_RUN
@ 2025-10-02 10:03 Paul Chaignon
  2025-10-02 10:05 ` [PATCH bpf-next v5 1/5] bpf: Refactor cleanup of bpf_prog_test_run_skb Paul Chaignon
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Paul Chaignon @ 2025-10-02 10:03 UTC (permalink / raw)
  To: bpf
  Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Eduard Zingerman, Amery Hung, Martin KaFai Lau

This patchset adds support for non-linear skbs when running tc programs
with BPF_PROG_TEST_RUN.

We've had multiple bugs in the past few years in Cilium caused by
missing calls to bpf_skb_pull_data(). Daniel suggested this new
BPF_PROG_TEST_RUN flag as a way to uncover these bugs in our BPF tests.

Changes in v5:
  - Fix double free on data in first patch.
Changes in v4:
  - Per Martin's suggestion, follow the XDP code pattern and use
    bpf_test_init only to initialize the linear area. That way data is
    directly copied to the right areas and we avoid the call to
    __pskb_pull_tail.
  - Fixed outdated commit descriptions.
  - Rebased.
Changes in v3:
  - Dropped BPF_F_TEST_SKB_NON_LINEAR and used the ctx->data_end to
    determine if the user wants non-linear skb, as suggested by Amery.
  - Introduced a second commit with a bit of refactoring to allow for
    the above requested change.
  - Fix bug found by syzkaller on third commit.
  - Rebased.
Changes in v2:
  - Made the linear size configurable via ctx->data_end, as suggested
    by Amery.
  - Reworked the selftests to allow testing the configurable linear
    size.
  - Fix warnings reported by kernel test robot on first commit.
  - Rebased.

Paul Chaignon (5):
  bpf: Refactor cleanup of bpf_prog_test_run_skb
  bpf: Reorder bpf_prog_test_run_skb initialization
  bpf: Craft non-linear skbs in BPF_PROG_TEST_RUN
  selftests/bpf: Support non-linear flag in test loader
  selftests/bpf: Test direct packet access on non-linear skbs

 net/bpf/test_run.c                            | 107 ++++++++++++++----
 tools/testing/selftests/bpf/progs/bpf_misc.h  |   4 +
 .../bpf/progs/verifier_direct_packet_access.c |  54 +++++++++
 tools/testing/selftests/bpf/test_loader.c     |  19 +++-
 4 files changed, 157 insertions(+), 27 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2025-10-06 20:50 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-02 10:03 [PATCH bpf-next v5 0/5] Support non-linear skbs for BPF_PROG_TEST_RUN Paul Chaignon
2025-10-02 10:05 ` [PATCH bpf-next v5 1/5] bpf: Refactor cleanup of bpf_prog_test_run_skb Paul Chaignon
2025-10-02 10:07 ` [PATCH bpf-next v5 2/5] bpf: Reorder bpf_prog_test_run_skb initialization Paul Chaignon
2025-10-02 10:07 ` [PATCH bpf-next v5 3/5] bpf: Craft non-linear skbs in BPF_PROG_TEST_RUN Paul Chaignon
2025-10-02 16:07   ` Amery Hung
2025-10-02 16:28     ` Amery Hung
2025-10-02 18:27   ` Martin KaFai Lau
2025-10-06 14:04     ` Paul Chaignon
2025-10-06 18:58       ` Martin KaFai Lau
2025-10-06 20:50         ` Paul Chaignon
2025-10-02 10:07 ` [PATCH bpf-next v5 4/5] selftests/bpf: Support non-linear flag in test loader Paul Chaignon
2025-10-02 10:07 ` [PATCH bpf-next v5 5/5] selftests/bpf: Test direct packet access on non-linear skbs Paul Chaignon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox