[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzZe8qQ-04uTHWBiYGVqCbRrJzt1C0Uw_AZARtqOTOEPUg@mail.gmail.com>
Date: Wed, 16 Oct 2019 12:49:43 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Alexei Starovoitov <ast@...nel.org>
Cc: "David S. Miller" <davem@...emloft.net>,
Daniel Borkmann <daniel@...earbox.net>, x86@...nel.org,
Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
Kernel Team <kernel-team@...com>
Subject: Re: [PATCH v3 bpf-next 05/11] libbpf: auto-detect btf_id of BTF-based raw_tracepoints
On Wed, Oct 16, 2019 at 4:14 AM Alexei Starovoitov <ast@...nel.org> wrote:
>
> It's a responsiblity of bpf program author to annotate the program
> with SEC("tp_btf/name") where "name" is a valid raw tracepoint.
> The libbpf will try to find "name" in vmlinux BTF and error out
> in case vmlinux BTF is not available or "name" is not found.
> If "name" is indeed a valid raw tracepoint then in-kernel BTF
> will have "btf_trace_##name" typedef that points to function
> prototype of that raw tracepoint. BTF description captures
> exact argument the kernel C code is passing into raw tracepoint.
> The kernel verifier will check the types while loading bpf program.
>
> libbpf keeps BTF type id in expected_attach_type, but since
> kernel ignores this attribute for tracing programs copy it
> into attach_btf_id attribute before loading.
>
> Later the kernel will use prog->attach_btf_id to select raw tracepoint
> during bpf_raw_tracepoint_open syscall command.
>
> Signed-off-by: Alexei Starovoitov <ast@...nel.org>
> ---
Great, this is much cleaner approach!
Acked-by: Andrii Nakryiko <andriin@...com>
> tools/lib/bpf/bpf.c | 3 +++
> tools/lib/bpf/libbpf.c | 38 ++++++++++++++++++++++++++++++++------
> 2 files changed, 35 insertions(+), 6 deletions(-)
>
[...]
Powered by blists - more mailing lists