mbox series

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

Message ID 20230714142100.42265-1-aspsk@isovalent.com
Headers show
Series allow bpf_map_sum_elem_count for all program types | expand

Message

Anton Protopopov July 14, 2023, 2:20 p.m. UTC
This short series is a follow up to the recent series [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 allows to treat CONST_PTR_TO_MAP as trusted pointers
from kfunc's point of view.

The second patch just adds const to the map argument of the
bpf_map_sum_elem_count kfunc.

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

Anton Protopopov (3):
  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                            | 5 ++++-
 tools/testing/selftests/bpf/progs/map_ptr_kern.c | 5 +++++
 4 files changed, 13 insertions(+), 5 deletions(-)