Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

libbpf: Fix uretprobe.multi.s programs auto attachment

As reported by Andrii we don't currently recognize uretprobe.multi.s
programs as return probes due to using (wrong) strcmp function.

Using str_has_pfx() instead to match uretprobe.multi prefix.

Tests are passing, because the return program was executed
as entry program and all counts were incremented properly.

Reported-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20240910125336.3056271-1-jolsa@kernel.org

authored by

Jiri Olsa and committed by
Andrii Nakryiko
8c8b4759 41d0c467

+1 -1
+1 -1
tools/lib/bpf/libbpf.c
··· 11688 11688 ret = 0; 11689 11689 break; 11690 11690 case 3: 11691 - opts.retprobe = strcmp(probe_type, "uretprobe.multi") == 0; 11691 + opts.retprobe = str_has_pfx(probe_type, "uretprobe.multi"); 11692 11692 *link = bpf_program__attach_uprobe_multi(prog, -1, binary_path, func_name, &opts); 11693 11693 ret = libbpf_get_error(*link); 11694 11694 break;