Skip to content

Commit 995e66d

Browse files
committed
t4
1 parent 082e35d commit 995e66d

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

kernel/bpf/verifier.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14273,19 +14273,17 @@ static int sanitize_check_bounds(struct bpf_verifier_env *env,
1427314273
if (check_stack_access_for_ptr_arithmetic(env, dst, dst_reg,
1427414274
dst_reg->off + dst_reg->var_off.value))
1427514275
return -EACCES;
14276-
break;
14276+
return 0;
1427714277
case PTR_TO_MAP_VALUE:
1427814278
if (check_map_access(env, dst, dst_reg->off, 1, false, ACCESS_HELPER)) {
1427914279
verbose(env, "R%d pointer arithmetic of map value goes out of range, "
1428014280
"prohibited for !root\n", dst);
1428114281
return -EACCES;
1428214282
}
14283-
break;
14283+
return 0;
1428414284
default:
14285-
break;
14285+
return -EOPNOTSUPP;
1428614286
}
14287-
14288-
return 0;
1428914287
}
1429014288

1429114289
/* 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,
1450914507
if (!check_reg_sane_offset(env, dst_reg, ptr_reg->type))
1451014508
return -EINVAL;
1451114509
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;
1451414513
if (sanitize_needed(opcode)) {
1451514514
ret = sanitize_ptr_alu(env, insn, dst_reg, off_reg, dst_reg,
1451614515
&info, true);
14516+
if (!can_skip_alu_sanitation(env, insn) && verifier_bug_if(scbe == -EOPNOTSUPP && !ret, env, "scb unsynced")) {
14517+
return -EFAULT;
14518+
}
1451714519
if (ret < 0)
1451814520
return ret;
1451914521
}

0 commit comments

Comments
 (0)