]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
bpf: fix do_misc_fixups() for bpf_get_branch_snapshot()
authorAndrii Nakryiko <andrii@kernel.org>
Wed, 23 Oct 2024 16:19:16 +0000 (09:19 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 24 Oct 2024 05:16:45 +0000 (22:16 -0700)
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>
Acked-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
Link: https://lore.kernel.org/r/20241023161916.2896274-1-andrii@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/verifier.c

index f9e2f1cd49750e19a30f19a5dd190a1ec4f37df4..587a6c76e564b3196fa4e0620ca4c2c273bf1875 100644 (file)
@@ -21210,7 +21210,7 @@ patch_map_ops_generic:
                        delta    += cnt - 1;
                        env->prog = prog = new_prog;
                        insn      = new_prog->insnsi + i + delta;
-                       continue;
+                       goto next_insn;
                }
 
                /* Implement bpf_kptr_xchg inline */