aboutsummaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/prog_tests/ksyms_module.c
diff options
context:
space:
mode:
authorKumar Kartikeya Dwivedi <memxor@gmail.com>2021-10-02 06:47:54 +0530
committerAlexei Starovoitov <ast@kernel.org>2021-10-05 17:07:42 -0700
commit9dbe6015636c19f929a7f7b742f27f303ff6069d (patch)
treefdc16578ed21cc313a0e035468e9c9cfa508d4d9 /tools/testing/selftests/bpf/prog_tests/ksyms_module.c
parent0e32dfc80bae53b05e9eda7eaf259f30ab9ba43a (diff)
libbpf: Support kernel module function calls
This patch adds libbpf support for kernel module function call support. The fd_array parameter is used during BPF program load to pass module BTFs referenced by the program. insn->off is set to index into this array, but starts from 1, because insn->off as 0 is reserved for btf_vmlinux. We try to use existing insn->off for a module, since the kernel limits the maximum distinct module BTFs for kfuncs to 256, and also because index must never exceed the maximum allowed value that can fit in insn->off (INT16_MAX). In the future, if kernel interprets signed offset as unsigned for kfunc calls, this limit can be increased to UINT16_MAX. Also introduce a btf__find_by_name_kind_own helper to start searching from module BTF's start id when we know that the BTF ID is not present in vmlinux BTF (in find_ksym_btf_id). Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20211002011757.311265-7-memxor@gmail.com
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/ksyms_module.c')
0 files changed, 0 insertions, 0 deletions