]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
libbpf: Fix uretprobe.multi.s programs auto attachment
authorJiri Olsa <jolsa@kernel.org>
Tue, 10 Sep 2024 12:53:36 +0000 (14:53 +0200)
committerAndrii Nakryiko <andrii@kernel.org>
Tue, 10 Sep 2024 18:35:13 +0000 (11:35 -0700)
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
tools/lib/bpf/libbpf.c

index 4f29e06c2641b91a61e5c74354f2518cea80b54f..84d4ec0e1f60125050dd81340d6444d821296f21 100644 (file)
@@ -11688,7 +11688,7 @@ static int attach_uprobe_multi(const struct bpf_program *prog, long cookie, stru
                ret = 0;
                break;
        case 3:
-               opts.retprobe = strcmp(probe_type, "uretprobe.multi") == 0;
+               opts.retprobe = str_has_pfx(probe_type, "uretprobe.multi");
                *link = bpf_program__attach_uprobe_multi(prog, -1, binary_path, func_name, &opts);
                ret = libbpf_get_error(*link);
                break;