bpf: Properly mark live registers for indirect jumps

[ Upstream commit d1aab1ca576c90192ba961094d51b0be6355a4d6 ]

For a `gotox rX` instruction the rX register should be marked as used
in the compute_insn_live_regs() function. Fix this.

Signed-off-by: Anton Protopopov <a.s.protopopov@gmail.com>
Link: https://lore.kernel.org/r/20260114162544.83253-2-a.s.protopopov@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Anton Protopopov 2026-01-14 16:25:43 +00:00 committed by Sasha Levin
parent aae391a79f
commit df02c3ff3b
1 changed files with 6 additions and 0 deletions

View File

@ -24292,6 +24292,12 @@ static void compute_insn_live_regs(struct bpf_verifier_env *env,
case BPF_JMP32: case BPF_JMP32:
switch (code) { switch (code) {
case BPF_JA: case BPF_JA:
def = 0;
if (BPF_SRC(insn->code) == BPF_X)
use = dst;
else
use = 0;
break;
case BPF_JCOND: case BPF_JCOND:
def = 0; def = 0;
use = 0; use = 0;