On Mon, Apr 24, 2023 at 9:05 AM Jiri Olsa <jolsa@xxxxxxxxxx> wrote: > > Adding new multi uprobe link that allows to attach bpf program > to multiple uprobes. > > Uprobes to attach are specified via new link_create uprobe_multi > union: > > struct { > __u32 flags; > __u32 cnt; > __aligned_u64 paths; > __aligned_u64 offsets; > __aligned_u64 ref_ctr_offsets; > } uprobe_multi; > > Uprobes are defined in paths/offsets/ref_ctr_offsets arrays with > the same 'cnt' length. Each uprobe is defined with a single index > in all three arrays: > > paths[idx], offsets[idx] and/or ref_ctr_offsets[idx] > > The 'flags' supports single bit for now that marks the uprobe as > return probe. > > Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx> > --- > include/linux/trace_events.h | 6 + > include/uapi/linux/bpf.h | 14 +++ > kernel/bpf/syscall.c | 16 ++- > kernel/trace/bpf_trace.c | 231 +++++++++++++++++++++++++++++++++++ > 4 files changed, 265 insertions(+), 2 deletions(-) > [...] > +static void bpf_uprobe_multi_link_dealloc(struct bpf_link *link) > +{ > + struct bpf_uprobe_multi_link *umulti_link; > + > + umulti_link = container_of(link, struct bpf_uprobe_multi_link, link); > + kvfree(umulti_link->uprobes); > + kfree(umulti_link); > +} > + > +static const struct bpf_link_ops bpf_uprobe_multi_link_lops = { > + .release = bpf_uprobe_multi_link_release, > + .dealloc = bpf_uprobe_multi_link_dealloc, > +}; > + let's implement show_fdinfo and fill_link_info as well? At least we can display how many instances of uprobe are attached for a given link? And depending on what we decide with single or multi paths per link, we could output path to the binary, right? And PID as well, if we agree that it's possible to support it. Thanks! [...]