[PATCH bpf-next 0/2] bpf: Allow access to const void pointer arguments in tracing programs
From: KaFai Wan
Date: Sat Apr 12 2025 - 13:06:46 EST
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@xxxxxxxxxx/
[2] https://lore.kernel.org/bpf/20211208193245.172141-1-jolsa@xxxxxxxxxx/
---
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