bpf: Force uprobe bpf program to always return 0
authorJiri Olsa <jolsa@kernel.org>
Fri, 8 Nov 2024 13:45:33 +0000 (14:45 +0100)
committerAndrii Nakryiko <andrii@kernel.org>
Mon, 11 Nov 2024 16:18:00 +0000 (08:18 -0800)
As suggested by Andrii make uprobe multi bpf programs to always return 0,
so they can't force uprobe removal.

Keeping the int return type for uprobe_prog_run, because it will be used
in following session changes.

Fixes: 89ae89f53d20 ("bpf: Add multi uprobe link")
Suggested-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20241108134544.480660-3-jolsa@kernel.org
kernel/trace/bpf_trace.c

index 88fd628..db9e279 100644 (file)
@@ -3229,7 +3229,6 @@ static int uprobe_prog_run(struct bpf_uprobe *uprobe,
        struct bpf_prog *prog = link->link.prog;
        bool sleepable = prog->sleepable;
        struct bpf_run_ctx *old_run_ctx;
-       int err = 0;
 
        if (link->task && !same_thread_group(current, link->task))
                return 0;
@@ -3242,7 +3241,7 @@ static int uprobe_prog_run(struct bpf_uprobe *uprobe,
        migrate_disable();
 
        old_run_ctx = bpf_set_run_ctx(&run_ctx.run_ctx);
-       err = bpf_prog_run(link->link.prog, regs);
+       bpf_prog_run(link->link.prog, regs);
        bpf_reset_run_ctx(old_run_ctx);
 
        migrate_enable();
@@ -3251,7 +3250,7 @@ static int uprobe_prog_run(struct bpf_uprobe *uprobe,
                rcu_read_unlock_trace();
        else
                rcu_read_unlock();
-       return err;
+       return 0;
 }
 
 static bool