public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next v2 0/2] libbpf: allow address-based single kprobe attach
@ 2026-03-29 12:43 Hoyeon Lee
  2026-03-29 12:43 ` [PATCH bpf-next v2 1/2] " Hoyeon Lee
  2026-03-29 12:43 ` [PATCH bpf-next v2 2/2] selftests/bpf: add test for " Hoyeon Lee
  0 siblings, 2 replies; 11+ messages in thread
From: Hoyeon Lee @ 2026-03-29 12:43 UTC (permalink / raw)
  To: bpf, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau
  Cc: Eduard Zingerman, Kumar Kartikeya Dwivedi, Song Liu,
	Yonghong Song, Jiri Olsa, Shuah Khan, Feng Yang, linux-kselftest,
	linux-kernel

Today libbpf can attach a single kprobe only by function name, with an
optional offset. But the kernel also supports attaching a single kprobe
directly by raw kernel address, through both legacy tracefs/debugfs
kprobes and PMU-based non-legacy kprobes. Since libbpf doesn't support
this yet, callers that already have a target IP still have to drop down
to perf_event_open() or direct tracefs writes.

This patchset adds address-based single-kprobe attach support to
bpf_program__attach_kprobe_opts() and covers it in selftests/bpf. The
first commit adds bpf_kprobe_opts.addr so that libbpf can attach single
kprobes by raw address through both legacy tracefs/debugfs and PMU-based
non-legacy paths. The second commit extends attach_probe selftests/bpf
with address-based kprobe attach subtests for these paths.

---
Changes in v2:
- Fix line wrapping and indentation

Hoyeon Lee (2):
  libbpf: allow address-based single kprobe attach
  selftests/bpf: add test for address-based single kprobe attach

 tools/lib/bpf/libbpf.c                        | 88 +++++++++++++------
 tools/lib/bpf/libbpf.h                        |  5 +-
 .../selftests/bpf/prog_tests/attach_probe.c   | 49 +++++++++++
 3 files changed, 114 insertions(+), 28 deletions(-)

-- 
2.52.0

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-03-31  5:55 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-29 12:43 [PATCH bpf-next v2 0/2] libbpf: allow address-based single kprobe attach Hoyeon Lee
2026-03-29 12:43 ` [PATCH bpf-next v2 1/2] " Hoyeon Lee
2026-03-30 10:08   ` Jiri Olsa
2026-03-31  1:47     ` Hoyeon Lee
2026-03-31  0:33   ` Andrii Nakryiko
2026-03-31  1:48     ` Hoyeon Lee
2026-03-31  2:15       ` Alexei Starovoitov
2026-03-31  5:55         ` Hoyeon Lee
2026-03-29 12:43 ` [PATCH bpf-next v2 2/2] selftests/bpf: add test for " Hoyeon Lee
2026-03-30 10:08   ` Jiri Olsa
2026-03-31  2:01     ` Hoyeon Lee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox