diff options
| author | Philo Lu <[email protected]> | 2024-09-11 03:37:15 +0000 |
|---|---|---|
| committer | Martin KaFai Lau <[email protected]> | 2024-09-11 15:56:37 +0000 |
| commit | 8aeaed21befc90f27f4fca6dd190850d97d2e9e3 (patch) | |
| tree | e56c73aacde63828784d60bf03d78c246f509b12 /tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c | |
| parent | bpf, cpumap: Move xdp:xdp_cpumap_kthread tracepoint before rcv (diff) | |
| download | kernel-8aeaed21befc90f27f4fca6dd190850d97d2e9e3.tar.gz kernel-8aeaed21befc90f27f4fca6dd190850d97d2e9e3.zip | |
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 <[email protected]>
Signed-off-by: Philo Lu <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Martin KaFai Lau <[email protected]>
Diffstat (limited to 'tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c')
0 files changed, 0 insertions, 0 deletions
