bpf/libbpf: BTF support for typed ksyms
authorHao Luo <haoluo@google.com>
Tue, 29 Sep 2020 23:50:45 +0000 (16:50 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 2 Oct 2020 21:59:25 +0000 (14:59 -0700)
commitd370bbe1214381f444cbd9cdf3b8647223abb536
treed4a0fd5035fb2c95af17be35073c99958913cd49
parent4976b718c3551faba2c0616ef55ebeb74db1c5ca
bpf/libbpf: BTF support for typed ksyms

If a ksym is defined with a type, libbpf will try to find the ksym's btf
information from kernel btf. If a valid btf entry for the ksym is found,
libbpf can pass in the found btf id to the verifier, which validates the
ksym's type and value.

Typeless ksyms (i.e. those defined as 'void') will not have such btf_id,
but it has the symbol's address (read from kallsyms) and its value is
treated as a raw pointer.

Signed-off-by: Hao Luo <haoluo@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/20200929235049.2533242-3-haoluo@google.com
tools/lib/bpf/libbpf.c