public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 bpf-next 0/4] allow bpf_map_sum_elem_count for all program types
@ 2023-07-19  9:29 Anton Protopopov
  2023-07-19  9:29 ` [PATCH v2 bpf-next 1/4] bpf: consider types listed in reg2btf_ids as trusted Anton Protopopov
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Anton Protopopov @ 2023-07-19  9:29 UTC (permalink / raw)
  To: Martin KaFai Lau, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa, Mykola Lysenko,
	Shuah Khan, Hou Tao, Joe Stringer, Anton Protopopov, bpf,
	linux-kernel, linux-kselftest

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(-)

-- 
2.34.1


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

end of thread, other threads:[~2023-07-19 17:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-19  9:29 [PATCH v2 bpf-next 0/4] allow bpf_map_sum_elem_count for all program types Anton Protopopov
2023-07-19  9:29 ` [PATCH v2 bpf-next 1/4] bpf: consider types listed in reg2btf_ids as trusted Anton Protopopov
2023-07-19  9:29 ` [PATCH v2 bpf-next 2/4] bpf: consider CONST_PTR_TO_MAP as trusted pointer to struct bpf_map Anton Protopopov
2023-07-19  9:29 ` [PATCH v2 bpf-next 3/4] bpf: make an argument const in the bpf_map_sum_elem_count kfunc Anton Protopopov
2023-07-19  9:29 ` [PATCH v2 bpf-next 4/4] bpf: allow any program to use " Anton Protopopov
2023-07-19 17:00 ` [PATCH v2 bpf-next 0/4] allow bpf_map_sum_elem_count for all program types 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