diff options
| author | Kui-Feng Lee <[email protected]> | 2024-01-25 18:31:13 -0800 |
|---|---|---|
| committer | Martin KaFai Lau <[email protected]> | 2024-01-25 20:49:59 -0800 |
| commit | e6be8cd5d3cf54ccd0ae66027d6f4697b15f4c3e (patch) | |
| tree | ea60dfda94c8a06e4c14f90a4900b7167121d847 /tools/perf/scripts/python | |
| parent | be4840b33eb2ea7d80830530aab5fcbeaa90e857 (diff) | |
bpf: Fix error checks against bpf_get_btf_vmlinux().
In bpf_struct_ops_map_alloc, it needs to check for NULL in the returned
pointer of bpf_get_btf_vmlinux() when CONFIG_DEBUG_INFO_BTF is not set.
ENOTSUPP is used to preserve the same behavior before the
struct_ops kmod support.
In the function check_struct_ops_btf_id(), instead of redoing the
bpf_get_btf_vmlinux() that has already been done in syscall.c, the fix
here is to check for prog->aux->attach_btf_id.
BPF_PROG_TYPE_STRUCT_OPS must require attach_btf_id and syscall.c
guarantees a valid attach_btf as long as attach_btf_id is set.
When attach_btf_id is not set, this patch returns -ENOTSUPP
because it is what the selftest in test_libbpf_probe_prog_types()
and libbpf_probes.c are expecting for feature probing purpose.
Changes from v1:
- Remove an unnecessary NULL check in check_struct_ops_btf_id()
Reported-by: [email protected]
Closes: https://lore.kernel.org/bpf/[email protected]/
Reported-by: [email protected]
Closes: https://lore.kernel.org/bpf/[email protected]/
Fixes: fcc2c1fb0651 ("bpf: pass attached BTF to the bpf_struct_ops subsystem")
Signed-off-by: Kui-Feng Lee <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Martin KaFai Lau <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions