public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next v2 0/2] bpf: Allow access to const void pointer arguments in tracing programs
@ 2025-04-16 16:17 KaFai Wan
  2025-04-16 16:17 ` [PATCH bpf-next v2 1/2] " KaFai Wan
  2025-04-16 16:17 ` [PATCH bpf-next v2 2/2] selftests/bpf: Add test to access const void pointer argument in tracing program KaFai Wan
  0 siblings, 2 replies; 4+ messages in thread
From: KaFai Wan @ 2025-04-16 16:17 UTC (permalink / raw)
  To: martin.lau, ast, daniel, andrii, eddyz87, song, yonghong.song,
	john.fastabend, kpsingh, sdf, haoluo, jolsa, davem, edumazet,
	kuba, pabeni, horms, mykolal, shuah, memxor
  Cc: bpf, linux-kernel, linux-kselftest, kafai.wan, leon.hwang

If we try to access argument which is pointer to const void, it's an 
UNKNOWN type, verifier will fail to load.

Use is_void_or_int_ptr to check if type is void or int pointer. 
And fix selftests. 

---
KaFai Wan (2):
  bpf: Allow access to const void pointer arguments in tracing programs
  selftests/bpf: Add test to access const void pointer argument in
    tracing program

 kernel/bpf/btf.c                                     |  6 +++---
 net/bpf/test_run.c                                   |  8 +++++++-
 .../selftests/bpf/progs/verifier_btf_ctx_access.c    | 12 ++++++++++++
 3 files changed, 22 insertions(+), 4 deletions(-)

Changelog:
v1->v2: Addressed comments from jirka
- use btf_type_is_void to check if type is void
- merge is_void_ptr and is_int_ptr to is_void_or_int_ptr
- fix selftests

Some details in here:
https://lore.kernel.org/all/20250412170626.3638516-1-kafai.wan@hotmail.com/

-- 
2.43.0


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

end of thread, other threads:[~2025-04-17 12:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-16 16:17 [PATCH bpf-next v2 0/2] bpf: Allow access to const void pointer arguments in tracing programs KaFai Wan
2025-04-16 16:17 ` [PATCH bpf-next v2 1/2] " KaFai Wan
2025-04-17 12:15   ` Jiri Olsa
2025-04-16 16:17 ` [PATCH bpf-next v2 2/2] selftests/bpf: Add test to access const void pointer argument in tracing program KaFai Wan

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