diff --git a/bpf/Makefile b/bpf/Makefile index 0301a64cb8c..6fd1bc5150d 100644 --- a/bpf/Makefile +++ b/bpf/Makefile @@ -34,6 +34,7 @@ PROCESS = bpf_execve_event.o bpf_execve_event_v53.o bpf_fork.o bpf_exit.o bpf_ge bpf_generic_tracepoint_v61.o \ bpf_multi_kprobe_v61.o bpf_multi_retkprobe_v61.o \ bpf_generic_uprobe_v61.o \ + bpf_multi_uprobe_v61.o \ bpf_loader.o \ bpf_killer.o bpf_multi_killer.o @@ -94,6 +95,7 @@ deps/bpf_multi_kprobe_$$(VAR).d: process/bpf_generic_kprobe.c deps/bpf_multi_retkprobe_$$(VAR).d: process/bpf_generic_retkprobe.c deps/bpf_generic_tracepoint_$$(VAR).d: process/bpf_generic_tracepoint.c deps/bpf_generic_uprobe_$$(VAR).d: process/bpf_generic_uprobe.c +deps/bpf_multi_uprobe_$$(VAR).d: process/bpf_generic_uprobe.c endef # Generic build targets for each sub-dir @@ -133,6 +135,9 @@ $(DEPSDIR)%_v53.d: objs/bpf_multi_kprobe_v61.ll objs/bpf_multi_retkprobe_v61.ll: $(CLANG) $(CLANG_FLAGS) -D__LARGE_BPF_PROG -D__V61_BPF_PROG -D__MULTI_KPROBE -c $< -o $@ +objs/bpf_multi_uprobe_v61.ll: + $(CLANG) $(CLANG_FLAGS) -D__LARGE_BPF_PROG -D__V60_BPF_PROG -D__MULTI_KPROBE -c $< -o $@ + objs/%_v61.ll: $(CLANG) $(CLANG_FLAGS) -D__LARGE_BPF_PROG -D__V61_BPF_PROG -c $< -o $@ diff --git a/bpf/process/bpf_generic_uprobe.c b/bpf/process/bpf_generic_uprobe.c index 862c07deb1a..a333d9bd873 100644 --- a/bpf/process/bpf_generic_uprobe.c +++ b/bpf/process/bpf_generic_uprobe.c @@ -79,11 +79,11 @@ generic_uprobe_start_process_filter(void *ctx) #ifdef __CAP_CHANGES_FILTER msg->sel.match_cap = 0; #endif + msg->idx = get_index(ctx); // setup index and function id config = map_lookup_elem(&config_map, &msg->idx); if (!config) return 0; - msg->idx = 0; msg->func_id = config->func_id; msg->retprobe_id = 0; if (!generic_process_filter_binary(config)) @@ -93,7 +93,13 @@ generic_uprobe_start_process_filter(void *ctx) return 0; } -__attribute__((section(("uprobe/generic_uprobe")), used)) int +#ifdef __MULTI_KPROBE +#define MAIN "uprobe.multi/generic_uprobe" +#else +#define MAIN "uprobe/generic_uprobe" +#endif + +__attribute__((section((MAIN)), used)) int generic_uprobe_event(struct pt_regs *ctx) { return generic_uprobe_start_process_filter(ctx);