| 1 | |
| 2 |
|
| 3 | #include <vmlinux.h>
|
| 4 | #include <bpf/bpf_tracing.h>
|
| 5 | #include "../test_kmods/bpf_testmod.h"
|
| 6 |
|
| 7 | char _license[] SEC("license") = "GPL";
|
| 8 |
|
| 9 | pid_t tgid = 0;
|
| 10 |
|
| 11 | |
| 12 | * that may be NULL. This is a test for the verifier to ensure that it can
|
| 13 | * rip PTR_MAYBE_NULL correctly.
|
| 14 |
|
| 15 | SEC("struct_ops/test_maybe_null")
|
| 16 | int BPF_PROG(test_maybe_null, int dummy,
|
| 17 | struct task_struct *task)
|
| 18 | {
|
| 19 | if (task)
|
| 20 | tgid = task->tgid;
|
| 21 |
|
| 22 | return 0;
|
| 23 | }
|
| 24 |
|
| 25 | SEC(".struct_ops.link")
|
| 26 | struct bpf_testmod_ops testmod_1 = {
|
| 27 | .test_maybe_null = (void *)test_maybe_null,
|
| 28 | };
|
| 29 |
|