mbox series

[bpf-next,0/3] introduce bpf_dynptr_copy kfunc

Message ID 20250218190027.135888-1-mykyta.yatsenko5@gmail.com (mailing list archive)
Headers show
Series introduce bpf_dynptr_copy kfunc | expand

Message

Mykyta Yatsenko Feb. 18, 2025, 7 p.m. UTC
From: Mykyta Yatsenko <yatsenko@meta.com>

Introduce a new kfunc, bpf_dynptr_copy, which enables copying of
data from one dynptr to another. This functionality may be useful in
scenarios such as capturing XDP data to a ring buffer.
The patch set is split into 3 patches:
1. Refactor bpf_dynptr_read and bpf_dynptr_write by extracting code into
static functions, that allows calling them with no compiler warnings
2. Introduce bpf_dynptr_copy
3. Add tests for bpf_dynptr_copy

Mykyta Yatsenko (3):
  bpf/helpers: refactor bpf_dynptr_read and bpf_dynptr_write
  bpf/helpers: introduce bpf_dynptr_copy kfunc
  selftests/bpf: add tests for bpf_dynptr_copy

 kernel/bpf/helpers.c                          | 57 +++++++++++++-
 kernel/bpf/verifier.c                         |  3 +
 tools/testing/selftests/bpf/bpf_kfuncs.h      |  8 ++
 .../testing/selftests/bpf/prog_tests/dynptr.c | 25 ++++++
 .../selftests/bpf/progs/dynptr_success.c      | 77 +++++++++++++++++++
 5 files changed, 166 insertions(+), 4 deletions(-)