bpf: correct use/def for may_goto instruction
may_goto instruction does not use any registers,
but in compute_insn_live_regs() it was treated as a regular
conditional jump of kind BPF_K with r0 as source register.
Thus unnecessarily marking r0 as used.
Fixes: 14c8552db644 ("bpf: simple DFA-based live registers analysis")
Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
Link: https://lore.kernel.org/r/20250305085436.2731464-1-eddyz87@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
parent
c1d95a0f2d
commit
871ef8d50e
@ -23567,6 +23567,7 @@ static void compute_insn_live_regs(struct bpf_verifier_env *env,
|
||||
case BPF_JMP32:
|
||||
switch (code) {
|
||||
case BPF_JA:
|
||||
case BPF_JCOND:
|
||||
def = 0;
|
||||
use = 0;
|
||||
break;
|
||||
|
||||
@ -294,9 +294,9 @@ __naked void gotol(void)
|
||||
|
||||
SEC("socket")
|
||||
__log_level(2)
|
||||
__msg("0: 0......... (b7) r1 = 1")
|
||||
__msg("1: 01........ (e5) may_goto pc+1")
|
||||
__msg("2: 0......... (05) goto pc-3")
|
||||
__msg("0: .......... (b7) r1 = 1")
|
||||
__msg("1: .1........ (e5) may_goto pc+1")
|
||||
__msg("2: .......... (05) goto pc-3")
|
||||
__msg("3: .1........ (bf) r0 = r1")
|
||||
__msg("4: 0......... (95) exit")
|
||||
__naked void may_goto(void)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user