mbox series

[v2,bpf-next,0/5] Dynptr helpers

Message ID 20230420071414.570108-1-joannelkoong@gmail.com (mailing list archive)
Headers show
Series Dynptr helpers | expand

Message

Joanne Koong April 20, 2023, 7:14 a.m. UTC
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(-)

Comments

patchwork-bot+netdevbpf@kernel.org April 26, 2023, 6:20 p.m. UTC | #1
Hello:

This series was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:

On Thu, 20 Apr 2023 00:14:09 -0700 you wrote:
> 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:
> 
> [...]

Here is the summary with links:
  - [v2,bpf-next,1/5] bpf: Add bpf_dynptr_adjust
    https://git.kernel.org/bpf/bpf-next/c/a18ce61a6c1f
  - [v2,bpf-next,2/5] bpf: Add bpf_dynptr_is_null and bpf_dynptr_is_rdonly
    https://git.kernel.org/bpf/bpf-next/c/8365e486d6b1
  - [v2,bpf-next,3/5] bpf: Add bpf_dynptr_size
    https://git.kernel.org/bpf/bpf-next/c/8acc1b16a56f
  - [v2,bpf-next,4/5] bpf: Add bpf_dynptr_clone
    https://git.kernel.org/bpf/bpf-next/c/cdb12a71426d
  - [v2,bpf-next,5/5] selftests/bpf: add tests for dynptr convenience helpers
    https://git.kernel.org/bpf/bpf-next/c/a63fcb5ba776

You are awesome, thank you!