Skip to content

Commit ea25f91

Browse files
thejhborkmann
authored andcommitted
bpf: fix missing error return in check_stack_boundary()
Prevent indirect stack accesses at non-constant addresses, which would permit reading and corrupting spilled pointers. Fixes: f1174f7 ("bpf/verifier: rework value tracking") Signed-off-by: Jann Horn <jannh@google.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
1 parent 468f6ea commit ea25f91

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

kernel/bpf/verifier.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,6 +1303,7 @@ static int check_stack_boundary(struct bpf_verifier_env *env, int regno,
13031303
tnum_strn(tn_buf, sizeof(tn_buf), regs[regno].var_off);
13041304
verbose(env, "invalid variable stack read R%d var_off=%s\n",
13051305
regno, tn_buf);
1306+
return -EACCES;
13061307
}
13071308
off = regs[regno].off + regs[regno].var_off.value;
13081309
if (off >= 0 || off < -MAX_BPF_STACK || off + access_size > 0 ||

0 commit comments

Comments
 (0)