On 6/3/21 11:13 PM, Martin KaFai Lau wrote:
On Thu, Jun 03, 2021 at 02:01:13PM -0400, Kenny Ho wrote:
Hi,
I understand that helper functions available to bpf programs are
listed in include/uapi/linux/bpf.h and kernel headers can be made
available at /sys/kernel/kheaders.tar.xz with CONFIG_IKHEADERS. But
with the support of calling kernel functions from bpf programs, how
would one know which functions are whitelisted? Are the headers for
these whitelisted functions available via something like "bpftool btf
dump file /sys/kernel/btf/vmlinux format c"?
Like other whitelisted functions in BPF, the list is not in the vmlinux btf
now but could be a BTF extension in the future (Cc: Yonghong).
Currently I am working to add a custom dwarf attribute in llvm so we can
annotate global/static variables, global/static functions, function
arguments, struct/unions, struct/union fields, with arbitrary strings
and these strings will be preserved in dwarf so we can eventually
encode in BTF. The WIP patch is here https://reviews.llvm.org/D103667.
Making the kfunc call whitelist more accessible is useful in general.
The bpf tcp-cc struct_ops is the only prog type supporting kfunc call.
What is your use case to introspect this whitelist?
Agree. It would be good if you can share your use case.