diff options
author | Philo Lu <lulie@linux.alibaba.com> | 2024-09-11 11:37:15 +0800 |
---|---|---|
committer | Martin KaFai Lau <martin.lau@kernel.org> | 2024-09-11 08:56:37 -0700 |
commit | 8aeaed21befc90f27f4fca6dd190850d97d2e9e3 (patch) | |
tree | e56c73aacde63828784d60bf03d78c246f509b12 /tools/testing/selftests/bpf/bpf_testmod/bpf_testmod-events.h | |
parent | 23dc9867329c72b48e5039ac93fbf50d9099cdb3 (diff) |
bpf: Support __nullable argument suffix for tp_btf
Pointers passed to tp_btf were trusted to be valid, but some tracepoints
do take NULL pointer as input, such as trace_tcp_send_reset(). Then the
invalid memory access cannot be detected by verifier.
This patch fix it by add a suffix "__nullable" to the unreliable
argument. The suffix is shown in btf, and PTR_MAYBE_NULL will be added
to nullable arguments. Then users must check the pointer before use it.
A problem here is that we use "btf_trace_##call" to search func_proto.
As it is a typedef, argument names as well as the suffix are not
recorded. To solve this, I use bpf_raw_event_map to find
"__bpf_trace##template" from "btf_trace_##call", and then we can see the
suffix.
Suggested-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Philo Lu <lulie@linux.alibaba.com>
Link: https://lore.kernel.org/r/20240911033719.91468-2-lulie@linux.alibaba.com
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/bpf_testmod/bpf_testmod-events.h')
0 files changed, 0 insertions, 0 deletions