diff mbox series

[PATCHv6,bpf-next,04/16] bpf: Force uprobe bpf program to always return 0

Message ID 20241010200957.2750179-5-jolsa@kernel.org (mailing list archive)
State New
Delegated to: BPF
Headers show
Series uprobe, bpf: Add session support | expand

Checks

Context Check Description
bpf/vmtest-bpf-next-PR fail merge-conflict
netdev/tree_selection success Clearly marked for bpf-next, async
netdev/apply fail Patch does not apply to bpf-next-0

Commit Message

Jiri Olsa Oct. 10, 2024, 8:09 p.m. UTC
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>
---
 kernel/trace/bpf_trace.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Andrii Nakryiko Oct. 11, 2024, 2:20 a.m. UTC | #1
On Thu, Oct 10, 2024 at 1:10 PM Jiri Olsa <jolsa@kernel.org> wrote:
>
> 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>
> ---
>  kernel/trace/bpf_trace.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>

Acked-by: Andrii Nakryiko <andrii@kernel.org>

> diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
> index fdab7ecd8dfa..3c1e5a561df4 100644
> --- a/kernel/trace/bpf_trace.c
> +++ b/kernel/trace/bpf_trace.c
> @@ -3209,7 +3209,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;
> @@ -3222,7 +3221,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();
> @@ -3231,7 +3230,7 @@ static int uprobe_prog_run(struct bpf_uprobe *uprobe,
>                 rcu_read_unlock_trace();
>         else
>                 rcu_read_unlock();
> -       return err;
> +       return 0;
>  }
>
>  static bool
> --
> 2.46.2
>
diff mbox series

Patch

diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
index fdab7ecd8dfa..3c1e5a561df4 100644
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -3209,7 +3209,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;
@@ -3222,7 +3221,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();
@@ -3231,7 +3230,7 @@  static int uprobe_prog_run(struct bpf_uprobe *uprobe,
 		rcu_read_unlock_trace();
 	else
 		rcu_read_unlock();
-	return err;
+	return 0;
 }
 
 static bool