BPF List
 help / color / mirror / Atom feed
* [PATCH v2 bpf-next 0/5] Dynptr helpers
@ 2023-04-20  7:14 Joanne Koong
  2023-04-20  7:14 ` [PATCH v2 bpf-next 1/5] bpf: Add bpf_dynptr_adjust Joanne Koong
                   ` (5 more replies)
  0 siblings, 6 replies; 23+ messages in thread
From: Joanne Koong @ 2023-04-20  7:14 UTC (permalink / raw)
  To: bpf; +Cc: andrii, ast, daniel, Joanne Koong

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/20220523210712.3641569-1-joannelkoong@gmail.com/
[1] https://lore.kernel.org/bpf/20230301154953.641654-1-joannelkoong@gmail.com/

v1 -> v2:
v1: https://lore.kernel.org/bpf/20230409033431.3992432-1-joannelkoong@gmail.com/
* 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(-)

-- 
2.34.1


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

end of thread, other threads:[~2023-04-28 21:08 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-20  7:14 [PATCH v2 bpf-next 0/5] Dynptr helpers Joanne Koong
2023-04-20  7:14 ` [PATCH v2 bpf-next 1/5] bpf: Add bpf_dynptr_adjust Joanne Koong
2023-04-20 18:38   ` Alexei Starovoitov
2023-04-21  3:46     ` Joanne Koong
2023-04-22 23:44       ` Alexei Starovoitov
2023-04-25  5:05         ` Joanne Koong
2023-04-25 23:46           ` Alexei Starovoitov
2023-04-26 17:50             ` Andrii Nakryiko
2023-04-24 14:31   ` Eduard Zingerman
2023-04-24 14:33     ` Eduard Zingerman
2023-04-24 19:46   ` John Fastabend
2023-04-25  5:29     ` Joanne Koong
2023-04-26 17:46       ` Andrii Nakryiko
2023-04-28 21:08         ` John Fastabend
2023-04-20  7:14 ` [PATCH v2 bpf-next 2/5] bpf: Add bpf_dynptr_is_null and bpf_dynptr_is_rdonly Joanne Koong
2023-04-24 19:49   ` John Fastabend
2023-04-20  7:14 ` [PATCH v2 bpf-next 3/5] bpf: Add bpf_dynptr_size Joanne Koong
2023-04-24 19:52   ` John Fastabend
2023-04-20  7:14 ` [PATCH v2 bpf-next 4/5] bpf: Add bpf_dynptr_clone Joanne Koong
2023-04-26 18:16   ` Andrii Nakryiko
2023-04-20  7:14 ` [PATCH v2 bpf-next 5/5] selftests/bpf: add tests for dynptr convenience helpers Joanne Koong
2023-04-26 18:17   ` Andrii Nakryiko
2023-04-26 18:20 ` [PATCH v2 bpf-next 0/5] Dynptr helpers patchwork-bot+netdevbpf

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