[PATCH bpf-next v4 1/2] bpf: Allow access to const void pointer arguments in tracing programs

2025-04-23 Thread KaFai Wan
() R10=fp0 ; asm volatile ("r2 = *(u64 *)(r1 + 8); "); 0: (79) r2 = *(u64 *)(r1 +8) func 'kfree' arg1 type UNKNOWN is not a struct Changing the is_int_ptr to void and generic integer check and renaming it to is_void_or_int_ptr. Cc: Leon Hwang Signed-off-by: KaFai Wan

[PATCH bpf-next v4 2/2] selftests/bpf: Add test to access const void pointer argument in tracing program

2025-04-23 Thread KaFai Wan
Adding verifier test for accessing const void pointer argument in tracing programs. The test program loads 1st argument of bpf_fentry_test10 function which is const void pointer and checks that verifier allows that. Signed-off-by: KaFai Wan Acked-by: Jiri Olsa --- net/bpf/test_run.c

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

2025-04-23 Thread KaFai Wan
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. Add a selftest to check it. --- KaFai Wan (2): bpf: Allow access to const void pointer arguments in tracing pro

[PATCH bpf-next v3 2/2] selftests/bpf: Add test to access const void pointer argument in tracing program

2025-04-17 Thread KaFai Wan
Adding verifier test for accessing const void pointer argument in tracing programs. The test program loads 1st argument of bpf_fentry_test10 function which is const void pointer and checks that verifier allows that. Signed-off-by: KaFai Wan --- net/bpf/test_run.c

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

2025-04-17 Thread KaFai Wan
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. Add a selftest to check it. --- KaFai Wan (2): bpf: Allow access to const void pointer arguments in tracing pro

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

2025-04-16 Thread KaFai Wan
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 pro

[PATCH bpf-next v2 2/2] selftests/bpf: Add test to access const void pointer argument in tracing program

2025-04-16 Thread KaFai Wan
Adding verifier test for accessing const void pointer argument in tracing programs. The test program loads 1st argument of bpf_fentry_test10 function which is const void pointer and checks that verifier allows that. Signed-off-by: KaFai Wan --- net/bpf/test_run.c

[PATCH bpf-next v2 1/2] bpf: Allow access to const void pointer arguments in tracing programs

2025-04-16 Thread KaFai Wan
() R10=fp0 ; asm volatile ("r2 = *(u64 *)(r1 + 8); "); 0: (79) r2 = *(u64 *)(r1 +8) func 'kfree' arg1 type UNKNOWN is not a struct Changing the is_int_ptr to void and generic integer check and renaming it to is_void_or_int_ptr. Cc: Leon Hwang Signed-off-by: KaFai Wan ---

Re: [PATCH bpf-next 1/2] bpf: Allow access to const void pointer arguments in tracing programs

2025-04-15 Thread Kafai Wan
On Mon, Apr 14, 2025 at 6:35 PM Jiri Olsa wrote: > > On Sun, Apr 13, 2025 at 01:06:25AM +0800, KaFai Wan wrote: > > Adding support to access arguments with const void pointer arguments > > in tracing programs. > > > > Currently we allow tracing programs to acce

Re: [PATCH bpf-next 2/2] selftests/bpf: Add test to access const void pointer argument in tracing program

2025-04-15 Thread Kafai Wan
On Mon, Apr 14, 2025 at 6:35 PM Jiri Olsa wrote: > > On Sun, Apr 13, 2025 at 01:06:26AM +0800, KaFai Wan wrote: > > Adding verifier test for accessing const void pointer argument in > > tracing programs. > > > > The test program loads 2nd argument of kfree tp_btf w

[PATCH bpf-next 2/2] selftests/bpf: Add test to access const void pointer argument in tracing program

2025-04-12 Thread KaFai Wan
Adding verifier test for accessing const void pointer argument in tracing programs. The test program loads 2nd argument of kfree tp_btf which is const void pointer and checks that verifier allows that. Signed-off-by: KaFai Wan --- .../selftests/bpf/progs/verifier_btf_ctx_access.c| 9

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

2025-04-12 Thread KaFai Wan
;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-...@kernel.org/ [2] https://lore.kernel.org/bpf/20211208193245.172141-1-jo...@kernel.org/ --- KaFai Wan (2): bpf: Allow a

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

2025-04-12 Thread KaFai Wan
() R10=fp0 ; asm volatile ("r2 = *(u64 *)(r1 + 8); "); 0: (79) r2 = *(u64 *)(r1 +8) func 'kfree' arg1 type UNKNOWN is not a struct Adding is_void_ptr to generic void pointer check. Cc: Leon Hwang Signed-off-by: KaFai Wan --- kernel/bpf/btf.c | 10 +- 1 file changed