mbox series

[bpf-next,v2,0/2] libbpf: support "module:function" syntax for tracing programs

Message ID cover.1714469650.git.vmalik@redhat.com (mailing list archive)
Headers show
Series libbpf: support "module:function" syntax for tracing programs | expand

Message

Viktor Malik April 30, 2024, 9:38 a.m. UTC
In some situations, it is useful to explicitly specify a kernel module
to search for a tracing program target (e.g. when a function of the same
name exists in multiple modules or in vmlinux).

This change enables that by allowing the "module:function" syntax for
the find_kernel_btf_id function. Thanks to this, the syntax can be used
both from a SEC macro (i.e. `SEC(fentry/module:function)`) and via the
bpf_program__set_attach_target API call.

--- 

Changes in v2:
- stylistic changes (suggested by Andrii)
- added Andrii's ack to the second patch

Viktor Malik (2):
  libbpf: support "module:function" syntax for tracing programs
  selftests/bpf: add tests for the "module:function" syntax

 tools/lib/bpf/libbpf.c                        | 35 ++++++++++++++-----
 .../selftests/bpf/prog_tests/module_attach.c  |  6 ++++
 .../selftests/bpf/progs/test_module_attach.c  | 23 ++++++++++++
 3 files changed, 55 insertions(+), 9 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org May 1, 2024, 5 p.m. UTC | #1
Hello:

This series was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:

On Tue, 30 Apr 2024 11:38:05 +0200 you wrote:
> In some situations, it is useful to explicitly specify a kernel module
> to search for a tracing program target (e.g. when a function of the same
> name exists in multiple modules or in vmlinux).
> 
> This change enables that by allowing the "module:function" syntax for
> the find_kernel_btf_id function. Thanks to this, the syntax can be used
> both from a SEC macro (i.e. `SEC(fentry/module:function)`) and via the
> bpf_program__set_attach_target API call.
> 
> [...]

Here is the summary with links:
  - [bpf-next,v2,1/2] libbpf: support "module:function" syntax for tracing programs
    https://git.kernel.org/bpf/bpf-next/c/8f8a024272f3
  - [bpf-next,v2,2/2] selftests/bpf: add tests for the "module:function" syntax
    https://git.kernel.org/bpf/bpf-next/c/960635887c96

You are awesome, thank you!