Skip to content

Dynptr helpers

Joanne Koong bpf 2 versions – Applied

Status from this message: Applied the patch set to bpf-next. Let's continue discussion about

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest5 patches 16 repliesApplied 5/5
  2. v15 patches 15 repliesSuperseded

Changes in v2 from the cover letter

v1: https://lore.kernel.org/bpf/[email protected]/
* change bpf_dynptr_advance/trim to bpf_dynptr_adjust
* rename bpf_dynptr_get_size to bpf_dynptr_size
* refactor handling clone for process_dynptr_func, maintain unique ids for parent and clone
* remove bpf_dynptr_get_offset()

Patches in v2 All 5 applied

#Subject and filesSizeRepliesApplied
1/5bpf: Add bpf_dynptr_adjustkernel/bpf/helpers.c+26 -012 repliesApplied
2/5bpf: Add bpf_dynptr_is_null and bpf_dynptr_is_rdonlykernel/bpf/helpers.c+19 -41 replyApplied
3/5bpf: Add bpf_dynptr_sizeinclude/linux/bpf.h kernel/bpf/helpers.c kernel/trace/bpf_trace.c+15 -61 replyApplied
4/5bpf: Add bpf_dynptr_clonekernel/bpf/helpers.c kernel/bpf/verifier.c+99 -201 replyApplied
5/5selftests/bpf: add tests for dynptr convenience helperstools/testing/selftests/bpf/bpf_kfuncs.h tools/testing/selftests/bpf/prog_tests/dynptr.c tools/testing/selftests/bpf/progs/dynptr_fail.c +1 more+597 -01 replyApplied

Reviews trailers per patch

2 of 5 patches have a Reviewed-by or Acked-by.

PatchAndrii NakryikoJohn Fastabend
1/5
2/5A-b A-b
3/5A-b
4/5
5/5

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 bpf-next 0/5] Dynptr helpers

This patchset is the 3rd in the dynptr series. The 1st (dynptr fundamentals) can be found here [0] and the second (skb + xdp dynptrs) can be found here [1].

This patchset adds the following helpers for interacting with dynptrs:

int bpf_dynptr_adjust(struct bpf_dynptr *ptr, __u32 start, __u32 end) __ksym; int bpf_dynptr_is_null(const struct bpf_dynptr *ptr) __ksym;
int bpf_dynptr_is_rdonly(const struct bpf_dynptr *ptr) __ksym;
__u32 bpf_dynptr_size(const struct bpf_dynptr *ptr) __ksym;
int bpf_dynptr_clone(const struct bpf_dynptr *ptr, struct bpf_dynptr *clone__init) __ksym;

[0] https://lore.kernel.org/bpf/[email protected]/
[1] https://lore.kernel.org/bpf/[email protected]/

v1 -> v2:
v1: https://lore.kernel.org/bpf/[email protected]/
* change bpf_dynptr_advance/trim to bpf_dynptr_adjust
* rename bpf_dynptr_get_size to bpf_dynptr_size
* refactor handling clone for process_dynptr_func, maintain unique ids for parent and clone
* remove bpf_dynptr_get_offset()

Joanne Koong (5):
bpf: Add bpf_dynptr_adjust
bpf: Add bpf_dynptr_is_null and bpf_dynptr_is_rdonly
bpf: Add bpf_dynptr_size
bpf: Add bpf_dynptr_clone
selftests/bpf: add tests for dynptr convenience helpers

 include/linux/bpf.h                           |   2 +-
 kernel/bpf/helpers.c                          |  76 ++++-
 kernel/bpf/verifier.c                         | 105 ++++--
 kernel/trace/bpf_trace.c                      |   4 +-
 tools/testing/selftests/bpf/bpf_kfuncs.h      |   6 +
 .../testing/selftests/bpf/prog_tests/dynptr.c |   6 +
 .../testing/selftests/bpf/progs/dynptr_fail.c | 287 +++++++++++++++++
 .../selftests/bpf/progs/dynptr_success.c      | 298 ++++++++++++++++++
 8 files changed, 755 insertions(+), 29 deletions(-)
Signature · 1 line
2.34.1