|
|
@@ -2712,8 +2712,8 @@ static int adjust_ptr_min_max_vals(struct bpf_verifier_env *env,
|
|
|
smin_ptr = ptr_reg->smin_value, smax_ptr = ptr_reg->smax_value;
|
|
|
u64 umin_val = off_reg->umin_value, umax_val = off_reg->umax_value,
|
|
|
umin_ptr = ptr_reg->umin_value, umax_ptr = ptr_reg->umax_value;
|
|
|
+ u32 dst = insn->dst_reg, src = insn->src_reg;
|
|
|
u8 opcode = BPF_OP(insn->code);
|
|
|
- u32 dst = insn->dst_reg;
|
|
|
|
|
|
dst_reg = ®s[dst];
|
|
|
|
|
|
@@ -2749,6 +2749,12 @@ static int adjust_ptr_min_max_vals(struct bpf_verifier_env *env,
|
|
|
dst);
|
|
|
return -EACCES;
|
|
|
}
|
|
|
+ if (ptr_reg->type == PTR_TO_MAP_VALUE &&
|
|
|
+ !env->allow_ptr_leaks && !known && (smin_val < 0) != (smax_val < 0)) {
|
|
|
+ verbose(env, "R%d has unknown scalar with mixed signed bounds, pointer arithmetic with it prohibited for !root\n",
|
|
|
+ off_reg == dst_reg ? dst : src);
|
|
|
+ return -EACCES;
|
|
|
+ }
|
|
|
|
|
|
/* In case of 'scalar += pointer', dst_reg inherits pointer type and id.
|
|
|
* The id may be overwritten later if we create a new variable offset.
|