Skip to content

bpf: Support bpf_get_func_ip helper in uprobes

Jiri Olsa bpf 3 versions – Applied

Status from this message: This series was applied to bpf/bpf-next.git (master)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest3 patches 4 repliesApplied 3/3
  2. v23 patches 2 repliesSuperseded
  3. v13 patches 10 repliesSuperseded

Changes in v3 from the cover letter

- removed bpf_get_func_ip_uprobe helper function [Yonghong]

Patches in v3 All 3 applied

#Subject and filesSizeRepliesApplied
1/3bpf: Add support for bpf_get_func_ip helper for uprobe programinclude/linux/bpf.h include/uapi/linux/bpf.h kernel/trace/bpf_trace.c +3 more+35 -112 repliesApplied
2/3selftests/bpf: Add bpf_get_func_ip tests for uprobe on function entrytools/testing/selftests/bpf/prog_tests/get_func_ip_test.c tools/testing/selftests/bpf/progs/get_func_ip_test.c+34 -21 replyApplied
3/3selftests/bpf: Add bpf_get_func_ip test for uprobe inside functiontools/testing/selftests/bpf/prog_tests/get_func_ip_test.c tools/testing/selftests/bpf/progs/get_func_ip_uprobe_test.c+60 -41 replyApplied

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchAlan MaguireViktor MalikYonghong Song
1/3T-b T-b A-b
2/3T-b A-b
3/3T-b A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v3 thread

Cover letter [PATCHv3 bpf-next 0/3] bpf: Support bpf_get_func_ip helper in uprobes

hi,
adding support for bpf_get_func_ip helper for uprobe program to return probed address for both uprobe and return uprobe as suggested by Andrii in [1].

We agreed that uprobe can have special use of bpf_get_func_ip helper that differs from kprobe.

The kprobe bpf_get_func_ip returns:
- address of the function if probe is attach on function entry for both kprobe and return kprobe
- 0 if the probe is not attach on function entry

The uprobe bpf_get_func_ip returns:
- address of the probe for both uprobe and return uprobe

The reason for this semantic change is that kernel can't really tell if the probe user space address is function entry.

v3 changes:
- removed bpf_get_func_ip_uprobe helper function [Yonghong]

Also available at:
https://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
uprobe_get_func_ip

thanks,
jirka

[1] https://lore.kernel.org/bpf/CAEf4BzZ=xLVkG5eurEuvLU79wAMtwho7ReR+XJAgwhFF4M-7Cg@mail.gmail.com/
---
Jiri Olsa (3):
bpf: Add support for bpf_get_func_ip helper for uprobe program
selftests/bpf: Add bpf_get_func_ip tests for uprobe on function entry selftests/bpf: Add bpf_get_func_ip test for uprobe inside function

 include/linux/bpf.h                                         |  9 +++++++--
 include/uapi/linux/bpf.h                                    |  7 ++++++-
 kernel/trace/bpf_trace.c                                    | 11 ++++++++++-
 kernel/trace/trace_probe.h                                  |  5 +++++
 kernel/trace/trace_uprobe.c                                 |  7 +------
 tools/include/uapi/linux/bpf.h                              |  7 ++++++-
 tools/testing/selftests/bpf/prog_tests/get_func_ip_test.c   | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++----
 tools/testing/selftests/bpf/progs/get_func_ip_test.c        | 25 +++++++++++++++++++++++--
 tools/testing/selftests/bpf/progs/get_func_ip_uprobe_test.c | 18 ++++++++++++++++++
 9 files changed, 129 insertions(+), 17 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/progs/get_func_ip_uprobe_test.c