mbox series

[bpf-next,0/6] bpf: Support ->fill_link_info for kprobe prog

Message ID 20230602085239.91138-1-laoar.shao@gmail.com (mailing list archive)
Headers show
Series bpf: Support ->fill_link_info for kprobe prog | expand

Message

Yafang Shao June 2, 2023, 8:52 a.m. UTC
Currently, it is not easy to determine which functions are probed by a
kprobe_multi program. This patchset supports ->fill_link_info for it, 
allowing the user to easily obtain the probed functions.

Although the user can retrieve the functions probed by a perf_event
program using `bpftool perf show`, it would be beneficial to also support
->fill_link_info. This way, the user can obtain it in the same manner as
other bpf links.

It would be preferable to expose the address directly rather than the symbol
name, as multiple functions may share the same name. These addresses
will be parsed by bpftool.

RFC->v1:
- Use a single copy_to_user() instead (Jiri)
- Show also the symbol name in bpftool (Quentin, Alexei)
- Use calloc() instead of malloc() in bpftool (Quentin)
- Avoid having conditional entries in the JSON output (Quentin)
- Drop ->show_fdinfo (Alexei)
- Use __u64 instead of __aligned_u64 for the field addr (Alexei)
- Avoid the contradiction in perf_event name length (Alexei) 
- Address a build warning reported by kernel test robot <lkp@intel.com>

Yafang Shao (6):
  bpf: Support ->fill_link_info for kprobe_multi
  bpftool: Show probed function in kprobe_multi link info
  bpf: Always expose the probed address
  bpf: Add a common helper bpf_copy_to_user()
  bpf: Support ->fill_link_info for perf_event
  bpftool: Show probed function in perf_event link info

 include/uapi/linux/bpf.h       |  10 ++++
 kernel/bpf/syscall.c           |  79 +++++++++++++++++++++++-----
 kernel/trace/bpf_trace.c       |  26 ++++++++++
 kernel/trace/trace_kprobe.c    |   2 +-
 tools/bpf/bpftool/link.c       | 115 ++++++++++++++++++++++++++++++++++++++++-
 tools/include/uapi/linux/bpf.h |  10 ++++
 6 files changed, 226 insertions(+), 16 deletions(-)