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

hi, 
Tracing programs can access arguments via BTF [1]. Currently we allow 
tracing programs to access pointers to string (char pointer), 
void pointers, pointers to structs, and int pointers [2].

If we try to access argument which is pointer to const void like 2nd 
argument in kfree, it's an UNKNOWN type, verifier will fail to load. 
typedef void (*btf_trace_kfree)(void *, long unsigned int, const void *);

[1] https://lore.kernel.org/bpf/20191016032505.2089704-7-ast@kernel.org/
[2] https://lore.kernel.org/bpf/20211208193245.172141-1-jolsa@kernel.org/
---
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                                       | 10 +++++++++-
 .../selftests/bpf/progs/verifier_btf_ctx_access.c      |  9 +++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)

-- 
2.43.0


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

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

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

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