From: Daniel Borkmann Date: Fri, 22 Dec 2017 15:23:08 +0000 (+0100) Subject: bpf: fix missing error return in check_stack_boundary() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2120fca0ecfb4552d27608d409ebd3403ce02ce4;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git bpf: fix missing error return in check_stack_boundary() From: Jann Horn Prevent indirect stack accesses at non-constant addresses, which would permit reading and corrupting spilled pointers. Fixes: f1174f77b50c ("bpf/verifier: rework value tracking") Signed-off-by: Jann Horn Signed-off-by: Alexei Starovoitov Signed-off-by: Daniel Borkmann Signed-off-by: Greg Kroah-Hartman --- diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index 0c7e4c8a2b8a..8aa98a0591d6 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -1303,6 +1303,7 @@ static int check_stack_boundary(struct bpf_verifier_env *env, int regno, tnum_strn(tn_buf, sizeof(tn_buf), regs[regno].var_off); verbose("invalid variable stack read R%d var_off=%s\n", regno, tn_buf); + return -EACCES; } off = regs[regno].off + regs[regno].var_off.value; if (off >= 0 || off < -MAX_BPF_STACK || off + access_size > 0 ||