summaryrefslogtreecommitdiff
path: root/kernel/bpf
diff options
context:
space:
mode:
authorAlexei Starovoitov <ast@kernel.org>2024-06-20 19:48:29 -0700
committerAlexei Starovoitov <ast@kernel.org>2024-06-20 19:48:29 -0700
commit3b06304370931f90cd6f50ea9dd55603429b13dc (patch)
treebc2ef689e85ff2ba195560840d0171d8e3629887 /kernel/bpf
parentf6afdaf72af7583d251bd569ded8d7d1eeb849c2 (diff)
parentf663a03c8e35c5156bad073a4a8f5e673d656e3f (diff)
Merge branch 'bpf-verifier-correct-tail_call_reachable-for-bpf-prog'
Leon Hwang says: ==================== bpf, verifier: Correct tail_call_reachable for bpf prog It's confusing to inspect 'prog->aux->tail_call_reachable' with drgn[0], when bpf prog has tail call but 'tail_call_reachable' is false. This patch corrects 'tail_call_reachable' when bpf prog has tail call. Therefore, it's unnecessary to detect tail call in x86 jit. Let's remove it. Changes: v1 -> v2: * Address comment from Yonghong: * Remove unnecessary tail call detection in x86 jit. Acked-by: Eduard Zingerman <eddyz87@gmail.com> --- Links: [0] https://github.com/osandov/drgn ==================== Link: https://lore.kernel.org/r/20240610124224.34673-1-hffilwlqm@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'kernel/bpf')
-rw-r--r--kernel/bpf/verifier.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index dcbbf5f64c5d..ffe98a788c33 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -2982,8 +2982,10 @@ static int check_subprogs(struct bpf_verifier_env *env)
if (code == (BPF_JMP | BPF_CALL) &&
insn[i].src_reg == 0 &&
- insn[i].imm == BPF_FUNC_tail_call)
+ insn[i].imm == BPF_FUNC_tail_call) {
subprog[cur_subprog].has_tail_call = true;
+ subprog[cur_subprog].tail_call_reachable = true;
+ }
if (BPF_CLASS(code) == BPF_LD &&
(BPF_MODE(code) == BPF_ABS || BPF_MODE(code) == BPF_IND))
subprog[cur_subprog].has_ld_abs = true;