@@ -14273,19 +14273,17 @@ static int sanitize_check_bounds(struct bpf_verifier_env *env,
14273
14273
if (check_stack_access_for_ptr_arithmetic(env, dst, dst_reg,
14274
14274
dst_reg->off + dst_reg->var_off.value))
14275
14275
return -EACCES;
14276
- break ;
14276
+ return 0 ;
14277
14277
case PTR_TO_MAP_VALUE:
14278
14278
if (check_map_access(env, dst, dst_reg->off, 1, false, ACCESS_HELPER)) {
14279
14279
verbose(env, "R%d pointer arithmetic of map value goes out of range, "
14280
14280
"prohibited for !root\n", dst);
14281
14281
return -EACCES;
14282
14282
}
14283
- break ;
14283
+ return 0 ;
14284
14284
default:
14285
- break ;
14285
+ return -EOPNOTSUPP ;
14286
14286
}
14287
-
14288
- return 0;
14289
14287
}
14290
14288
14291
14289
/* Handles arithmetic on a pointer and a scalar: computes new min/max and var_off.
@@ -14509,11 +14507,15 @@ static int adjust_ptr_min_max_vals(struct bpf_verifier_env *env,
14509
14507
if (!check_reg_sane_offset(env, dst_reg, ptr_reg->type))
14510
14508
return -EINVAL;
14511
14509
reg_bounds_sync(dst_reg);
14512
- if (sanitize_check_bounds(env, insn, dst_reg) < 0)
14513
- return -EACCES;
14510
+ int scbe = sanitize_check_bounds(env, insn, dst_reg);
14511
+ if (scbe == -EACCES)
14512
+ return scbe;
14514
14513
if (sanitize_needed(opcode)) {
14515
14514
ret = sanitize_ptr_alu(env, insn, dst_reg, off_reg, dst_reg,
14516
14515
&info, true);
14516
+ if (!can_skip_alu_sanitation(env, insn) && verifier_bug_if(scbe == -EOPNOTSUPP && !ret, env, "scb unsynced")) {
14517
+ return -EFAULT;
14518
+ }
14517
14519
if (ret < 0)
14518
14520
return ret;
14519
14521
}
0 commit comments