lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 7 Dec 2020 19:14:42 -0800
From:   Andrii Nakryiko <>
To:     Saeed Mahameed <>
Cc:     bpf <>, Alexei Starovoitov <>,
        Daniel Borkmann <>,
        Networking <>,
        Saeed Mahameed <>,
        Andrii Nakryiko <>
Subject: Re: [PATCH bpf] tools/bpftool: Add/Fix support for modules btf dump

On Sun, Dec 6, 2020 at 9:21 PM <> wrote:
> From: Saeed Mahameed <>
> While playing with BTF for modules, i noticed that executing the command:
> $ bpftool btf dump id <module's btf id>
> Fails due to lack of information in the BTF data.
> Maybe I am missing a step but actually adding the support for this is
> very simple.

yes, bpftool takes -B <path> argument for specifying base BTF. So if
you added -B /sys/kernel/btf/vmlinux, it should have worked. I've
added auto-detection logic for the case of `btf dump file
/sys/kernel/btf/<module>` (see [0]), and we can also add it for when
ID corresponds to a module BTF. But I think it's simplest to re-use
the logic and just open /sys/kernel/btf/vmlinux, instead of adding
narrowly-focused libbpf API for that.

> To completely parse modules BTF data, we need the vmlinux BTF as their
> "base btf", which can be easily found by iterating through the btf ids and
> looking for == "vmlinux".
> I am not sure why this hasn't been added by the original patchset

because I never though of dumping module BTF by id, given there is
nicely named /sys/kernel/btf/<module> :)

> "Integrate kernel module BTF support", as adding the support for
> this is very trivial. Unless i am missing something, CCing Andrii..
> Signed-off-by: Saeed Mahameed <>
> CC: Andrii Nakryiko <>
> ---
>  tools/lib/bpf/btf.c      | 57 ++++++++++++++++++++++++++++++++++++++++
>  tools/lib/bpf/btf.h      |  2 ++
>  tools/lib/bpf/ |  1 +
>  3 files changed, 60 insertions(+)


Powered by blists - more mailing lists