Re: [PATCH bpf-next v3 2/6] bpf/libbpf: BTF support for typed ksyms

From: Andrii Nakryiko
Date: Mon Sep 21 2020 - 13:52:55 EST


On Wed, Sep 16, 2020 at 3:38 PM Hao Luo <haoluo@xxxxxxxxxx> wrote:
>
> 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@xxxxxxxxxx>
> ---

This looks nice and clean, thanks!

Acked-by: Andrii Nakryiko <andriin@xxxxxx>

> tools/lib/bpf/libbpf.c | 112 ++++++++++++++++++++++++++++++++++++-----
> 1 file changed, 99 insertions(+), 13 deletions(-)
>

[...]