mbox series

[bpf-next,0/2] bpf: Allow access to const void pointer arguments in tracing programs

Message ID 20250412170626.3638516-1-kafai.wan@hotmail.com
Headers show
Series bpf: Allow access to const void pointer arguments in tracing programs | expand

Message

KaFai Wan April 12, 2025, 5:06 p.m. UTC
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(-)