Skip to content

Commit d25da6c

Browse files
borkmanndavem330
authored andcommitted
bpf: don't check spilled reg state for non-STACK_SPILLed type slots
spilled_regs[] state is only used for stack slots of type STACK_SPILL, never for STACK_MISC. Right now, in states_equal(), even if we have old and current stack state of type STACK_MISC, we compare spilled_regs[] for that particular offset. Just skip these like we do everywhere else. Signed-off-by: Daniel Borkmann <[email protected]> Acked-by: Alexei Starovoitov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 20b9d7a commit d25da6c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

kernel/bpf/verifier.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2828,6 +2828,8 @@ static bool states_equal(struct bpf_verifier_env *env,
28282828
return false;
28292829
if (i % BPF_REG_SIZE)
28302830
continue;
2831+
if (old->stack_slot_type[i] != STACK_SPILL)
2832+
continue;
28312833
if (memcmp(&old->spilled_regs[i / BPF_REG_SIZE],
28322834
&cur->spilled_regs[i / BPF_REG_SIZE],
28332835
sizeof(old->spilled_regs[0])))

0 commit comments

Comments
 (0)