BPF List
 help / color / mirror / Atom feed
* [PATCH bpf] bpf: fix do_misc_fixups() for bpf_get_branch_snapshot()
@ 2024-10-23 16:19 Andrii Nakryiko
  2024-10-23 17:11 ` Yonghong Song
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Andrii Nakryiko @ 2024-10-23 16:19 UTC (permalink / raw)
  To: bpf, ast, daniel, martin.lau; +Cc: andrii, kernel-team, Shung-Hsi Yu

We need `goto next_insn;` at the end of patching instead of `continue;`.
It currently works by accident by making verifier re-process patched
instructions.

Reported-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
Fixes: 314a53623cd4 ("bpf: inline bpf_get_branch_snapshot() helper")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
 kernel/bpf/verifier.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index f9e2f1cd4975..587a6c76e564 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -21210,7 +21210,7 @@ static int do_misc_fixups(struct bpf_verifier_env *env)
 			delta    += cnt - 1;
 			env->prog = prog = new_prog;
 			insn      = new_prog->insnsi + i + delta;
-			continue;
+			goto next_insn;
 		}
 
 		/* Implement bpf_kptr_xchg inline */
-- 
2.43.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH bpf] bpf: fix do_misc_fixups() for bpf_get_branch_snapshot()
  2024-10-23 16:19 [PATCH bpf] bpf: fix do_misc_fixups() for bpf_get_branch_snapshot() Andrii Nakryiko
@ 2024-10-23 17:11 ` Yonghong Song
  2024-10-24  4:56 ` Shung-Hsi Yu
  2024-10-24  5:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Yonghong Song @ 2024-10-23 17:11 UTC (permalink / raw)
  To: Andrii Nakryiko, bpf, ast, daniel, martin.lau; +Cc: kernel-team, Shung-Hsi Yu


On 10/23/24 9:19 AM, Andrii Nakryiko wrote:
> We need `goto next_insn;` at the end of patching instead of `continue;`.
> It currently works by accident by making verifier re-process patched
> instructions.
>
> Reported-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
> Fixes: 314a53623cd4 ("bpf: inline bpf_get_branch_snapshot() helper")
> Signed-off-by: Andrii Nakryiko <andrii@kernel.org>

Acked-by: Yonghong Song <yonghong.song@linux.dev>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH bpf] bpf: fix do_misc_fixups() for bpf_get_branch_snapshot()
  2024-10-23 16:19 [PATCH bpf] bpf: fix do_misc_fixups() for bpf_get_branch_snapshot() Andrii Nakryiko
  2024-10-23 17:11 ` Yonghong Song
@ 2024-10-24  4:56 ` Shung-Hsi Yu
  2024-10-24  5:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Shung-Hsi Yu @ 2024-10-24  4:56 UTC (permalink / raw)
  To: Andrii Nakryiko; +Cc: bpf, ast, daniel, martin.lau, kernel-team

On Wed, Oct 23, 2024 at 09:19:16AM GMT, Andrii Nakryiko wrote:
> We need `goto next_insn;` at the end of patching instead of `continue;`.
> It currently works by accident by making verifier re-process patched
> instructions.
> 
> Reported-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
> Fixes: 314a53623cd4 ("bpf: inline bpf_get_branch_snapshot() helper")
> Signed-off-by: Andrii Nakryiko <andrii@kernel.org>

Acked-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH bpf] bpf: fix do_misc_fixups() for bpf_get_branch_snapshot()
  2024-10-23 16:19 [PATCH bpf] bpf: fix do_misc_fixups() for bpf_get_branch_snapshot() Andrii Nakryiko
  2024-10-23 17:11 ` Yonghong Song
  2024-10-24  4:56 ` Shung-Hsi Yu
@ 2024-10-24  5:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-10-24  5:20 UTC (permalink / raw)
  To: Andrii Nakryiko; +Cc: bpf, ast, daniel, martin.lau, kernel-team, shung-hsi.yu

Hello:

This patch was applied to bpf/bpf.git (master)
by Alexei Starovoitov <ast@kernel.org>:

On Wed, 23 Oct 2024 09:19:16 -0700 you wrote:
> We need `goto next_insn;` at the end of patching instead of `continue;`.
> It currently works by accident by making verifier re-process patched
> instructions.
> 
> Reported-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
> Fixes: 314a53623cd4 ("bpf: inline bpf_get_branch_snapshot() helper")
> Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
> 
> [...]

Here is the summary with links:
  - [bpf] bpf: fix do_misc_fixups() for bpf_get_branch_snapshot()
    https://git.kernel.org/bpf/bpf/c/9806f283140e

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-10-24  5:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-23 16:19 [PATCH bpf] bpf: fix do_misc_fixups() for bpf_get_branch_snapshot() Andrii Nakryiko
2024-10-23 17:11 ` Yonghong Song
2024-10-24  4:56 ` Shung-Hsi Yu
2024-10-24  5:20 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox