Skip to content

Commit 12a23f9

Browse files
eddyz87Alexei Starovoitov
authored andcommitted
bpf: remove redundant REG_LIVE_READ check in stacksafe()
stacksafe() is called in exact == NOT_EXACT mode only for states that had been porcessed by clean_verifier_states(). The latter replaces dead stack spills with a series of STACK_INVALID masks. Such masks are already handled by stacksafe(). Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20250918-callchain-sensitive-liveness-v3-3-c3cd27bacc60@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
1 parent 6cd21eb commit 12a23f9

File tree

1 file changed

+0
-7
lines changed

1 file changed

+0
-7
lines changed

kernel/bpf/verifier.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18785,13 +18785,6 @@ static bool stacksafe(struct bpf_verifier_env *env, struct bpf_func_state *old,
1878518785
cur->stack[spi].slot_type[i % BPF_REG_SIZE]))
1878618786
return false;
1878718787

18788-
if (!(old->stack[spi].spilled_ptr.live & REG_LIVE_READ)
18789-
&& exact == NOT_EXACT) {
18790-
i += BPF_REG_SIZE - 1;
18791-
/* explored state didn't use this */
18792-
continue;
18793-
}
18794-
1879518788
if (old->stack[spi].slot_type[i % BPF_REG_SIZE] == STACK_INVALID)
1879618789
continue;
1879718790

0 commit comments

Comments
 (0)