diff options
author | 2025-04-23 20:13:29 +0800 | |
---|---|---|
committer | 2025-04-23 11:26:22 -0700 | |
commit | 4c0a42c50021ee509f159c1f8a22efb35987c941 (patch) | |
tree | 069ebbc45d075ca64ca315272e816b911913f568 /net/bpf | |
parent | bpf: Allow access to const void pointer arguments in tracing programs (diff) | |
download | linux-rng-4c0a42c50021ee509f159c1f8a22efb35987c941.tar.xz linux-rng-4c0a42c50021ee509f159c1f8a22efb35987c941.zip |
selftests/bpf: Add test to access const void pointer argument in tracing program
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 <mannkafai@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/bpf/20250423121329.3163461-3-mannkafai@gmail.com
Diffstat (limited to 'net/bpf')
-rw-r--r-- | net/bpf/test_run.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c index 7cb192cbd65f..aaf13a7d58ed 100644 --- a/net/bpf/test_run.c +++ b/net/bpf/test_run.c @@ -569,6 +569,11 @@ __bpf_kfunc u32 bpf_fentry_test9(u32 *a) return *a; } +int noinline bpf_fentry_test10(const void *a) +{ + return (long)a; +} + void noinline bpf_fentry_test_sinfo(struct skb_shared_info *sinfo) { } @@ -699,7 +704,8 @@ int bpf_prog_test_run_tracing(struct bpf_prog *prog, bpf_fentry_test6(16, (void *)17, 18, 19, (void *)20, 21) != 111 || bpf_fentry_test7((struct bpf_fentry_test_t *)0) != 0 || bpf_fentry_test8(&arg) != 0 || - bpf_fentry_test9(&retval) != 0) + bpf_fentry_test9(&retval) != 0 || + bpf_fentry_test10((void *)0) != 0) goto out; break; case BPF_MODIFY_RETURN: |