mbox series

[v2,bpf-next,0/4] allow bpf_map_sum_elem_count for all program types

Message ID 20230719092952.41202-1-aspsk@isovalent.com (mailing list archive)
Headers show
Series allow bpf_map_sum_elem_count for all program types | expand

Message

Anton Protopopov July 19, 2023, 9:29 a.m. UTC
This series is a follow up to the recent change [1] which added
per-cpu insert/delete statistics for maps. The bpf_map_sum_elem_count
kfunc presented in the original series was only available to tracing
programs, so let's make it available to all.

The first patch makes types listed in the reg2btf_ids[] array to be
considered trusted by kfuncs.

The second patch allows to treat CONST_PTR_TO_MAP as trusted pointers from
kfunc's point of view by adding it to the reg2btf_ids[] array.

The third patch adds missing const to the map argument of the
bpf_map_sum_elem_count kfunc.

The fourth patch registers the bpf_map_sum_elem_count for all programs,
and patches selftests correspondingly.

  [1] https://lore.kernel.org/bpf/20230705160139.19967-1-aspsk@isovalent.com/

v1 -> v2:
  * treat the whole reg2btf_ids array as trusted (Alexei)

Anton Protopopov (4):
  bpf: consider types listed in reg2btf_ids as trusted
  bpf: consider CONST_PTR_TO_MAP as trusted pointer to struct bpf_map
  bpf: make an argument const in the bpf_map_sum_elem_count kfunc
  bpf: allow any program to use the bpf_map_sum_elem_count kfunc

 include/linux/btf_ids.h                       |  1 +
 kernel/bpf/map_iter.c                         |  7 +++---
 kernel/bpf/verifier.c                         | 22 +++++++++++--------
 .../selftests/bpf/progs/map_ptr_kern.c        |  5 +++++
 4 files changed, 22 insertions(+), 13 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org July 19, 2023, 5 p.m. UTC | #1
Hello:

This series was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:

On Wed, 19 Jul 2023 09:29:48 +0000 you wrote:
> This series is a follow up to the recent change [1] which added
> per-cpu insert/delete statistics for maps. The bpf_map_sum_elem_count
> kfunc presented in the original series was only available to tracing
> programs, so let's make it available to all.
> 
> The first patch makes types listed in the reg2btf_ids[] array to be
> considered trusted by kfuncs.
> 
> [...]

Here is the summary with links:
  - [v2,bpf-next,1/4] bpf: consider types listed in reg2btf_ids as trusted
    https://git.kernel.org/bpf/bpf-next/c/831deb2976de
  - [v2,bpf-next,2/4] bpf: consider CONST_PTR_TO_MAP as trusted pointer to struct bpf_map
    https://git.kernel.org/bpf/bpf-next/c/5ba190c29cf9
  - [v2,bpf-next,3/4] bpf: make an argument const in the bpf_map_sum_elem_count kfunc
    https://git.kernel.org/bpf/bpf-next/c/9c29804961c1
  - [v2,bpf-next,4/4] bpf: allow any program to use the bpf_map_sum_elem_count kfunc
    https://git.kernel.org/bpf/bpf-next/c/72829b1c1f16

You are awesome, thank you!