Commit ebdef9a
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]>1 parent 5f49d40 commit ebdef9a
2 files changed
+41
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6385 | 6385 | | |
6386 | 6386 | | |
6387 | 6387 | | |
| 6388 | + | |
| 6389 | + | |
| 6390 | + | |
| 6391 | + | |
| 6392 | + | |
| 6393 | + | |
6388 | 6394 | | |
6389 | 6395 | | |
6390 | 6396 | | |
| |||
6554 | 6560 | | |
6555 | 6561 | | |
6556 | 6562 | | |
| 6563 | + | |
| 6564 | + | |
| 6565 | + | |
6557 | 6566 | | |
6558 | 6567 | | |
6559 | 6568 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
| |||
21785 | 21787 | | |
21786 | 21788 | | |
21787 | 21789 | | |
| 21790 | + | |
21788 | 21791 | | |
| 21792 | + | |
21789 | 21793 | | |
21790 | 21794 | | |
21791 | 21795 | | |
21792 | | - | |
| 21796 | + | |
21793 | 21797 | | |
21794 | 21798 | | |
21795 | 21799 | | |
| |||
21920 | 21924 | | |
21921 | 21925 | | |
21922 | 21926 | | |
21923 | | - | |
21924 | | - | |
21925 | | - | |
| 21927 | + | |
| 21928 | + | |
| 21929 | + | |
| 21930 | + | |
| 21931 | + | |
| 21932 | + | |
21926 | 21933 | | |
| 21934 | + | |
| 21935 | + | |
| 21936 | + | |
| 21937 | + | |
| 21938 | + | |
| 21939 | + | |
| 21940 | + | |
| 21941 | + | |
| 21942 | + | |
| 21943 | + | |
| 21944 | + | |
| 21945 | + | |
| 21946 | + | |
| 21947 | + | |
| 21948 | + | |
| 21949 | + | |
| 21950 | + | |
| 21951 | + | |
| 21952 | + | |
| 21953 | + | |
| 21954 | + | |
21927 | 21955 | | |
21928 | 21956 | | |
21929 | 21957 | | |
| |||
0 commit comments