[RFC bpf-next 00/10] uprobe, bpf: Add session support

Jiri Olsa
2024-06-04T20:02:32Z

hi,
this patchset is adding support for session uprobe attachment
and using it through bpf link for bpf programs.

The session means that the uprobe consumer is executed on entry
and return of probed function with additional control:
- entry callback can control execution of the return callback
- entry and return callbacks can share data/cookie

On more details please see patch #1.

thanks,
jirka

---
Jiri Olsa (10):
uprobe: Add session callbacks to uprobe_consumer
bpf: Add support for uprobe multi session attach
bpf: Add support for uprobe multi session context
libbpf: Add support for uprobe multi session attach
libbpf: Add uprobe session attach type names to attach_type_name
selftests/bpf: Move ARRAY_SIZE to bpf_misc.h
selftests/bpf: Add uprobe session test
selftests/bpf: Add uprobe session errors test
selftests/bpf: Add uprobe session cookie test
selftests/bpf: Add uprobe session recursive test

include/linux/uprobes.h | 18 ++++++++++
include/uapi/linux/bpf.h | 1 +
kernel/bpf/syscall.c | 9 +++--
kernel/events/uprobes.c | 69 +++++++++++++++++++++++++++++++++-----
kernel/trace/bpf_trace.c | 72 +++++++++++++++++++++++++++++++---------
tools/include/uapi/linux/bpf.h | 1 +
tools/lib/bpf/bpf.c | 1 +
tools/lib/bpf/libbpf.c | 51 ++++++++++++++++++++++++++--
tools/lib/bpf/libbpf.h | 4 ++-
tools/testing/selftests/bpf/prog_tests/uprobe_multi_test.c | 153 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tools/testing/selftests/bpf/progs/bpf_misc.h | 2 ++
tools/testing/selftests/bpf/progs/iters.c | 2 --
tools/testing/selftests/bpf/progs/kprobe_multi_session.c | 3 +-
tools/testing/selftests/bpf/progs/linked_list.c | 5 +--
tools/testing/selftests/bpf/progs/netif_receive_skb.c | 5 +--
tools/testing/selftests/bpf/progs/profiler.inc.h | 5 +--
tools/testing/selftests/bpf/progs/setget_sockopt.c | 5 +--
tools/testing/selftests/bpf/progs/test_bpf_ma.c | 4 ---
tools/testing/selftests/bpf/progs/test_sysctl_loop1.c | 5 +--
tools/testing/selftests/bpf/progs/test_sysctl_loop2.c | 5 +--
tools/testing/selftests/bpf/progs/test_sysctl_prog.c | 5 +--
tools/testing/selftests/bpf/progs/test_tcp_custom_syncookie.c | 1 +
tools/testing/selftests/bpf/progs/test_tcp_custom_syncookie.h | 2 --
tools/testing/selftests/bpf/progs/uprobe_multi_session.c | 52 +++++++++++++++++++++++++++++
tools/testing/selftests/bpf/progs/uprobe_multi_session_cookie.c | 50 ++++++++++++++++++++++++++++
tools/testing/selftests/bpf/progs/uprobe_multi_session_recursive.c | 44 ++++++++++++++++++++++++
tools/testing/selftests/bpf/progs/verifier_subprog_precision.c | 2 --
27 files changed, 507 insertions(+), 69 deletions(-)
create mode 100644 tools/testing/selftests/bpf/progs/uprobe_multi_session.c
create mode 100644 tools/testing/selftests/bpf/progs/uprobe_multi_session_cookie.c
create mode 100644 tools/testing/selftests/bpf/progs/uprobe_multi_session_recursive.c