@@ -6486,15 +6486,19 @@ static bool sanitize_needed(u8 opcode)
6486
6486
return opcode == BPF_ADD || opcode == BPF_SUB ;
6487
6487
}
6488
6488
6489
+ struct bpf_sanitize_info {
6490
+ struct bpf_insn_aux_data aux ;
6491
+ };
6492
+
6489
6493
static int sanitize_ptr_alu (struct bpf_verifier_env * env ,
6490
6494
struct bpf_insn * insn ,
6491
6495
const struct bpf_reg_state * ptr_reg ,
6492
6496
const struct bpf_reg_state * off_reg ,
6493
6497
struct bpf_reg_state * dst_reg ,
6494
- struct bpf_insn_aux_data * tmp_aux ,
6498
+ struct bpf_sanitize_info * info ,
6495
6499
const bool commit_window )
6496
6500
{
6497
- struct bpf_insn_aux_data * aux = commit_window ? cur_aux (env ) : tmp_aux ;
6501
+ struct bpf_insn_aux_data * aux = commit_window ? cur_aux (env ) : & info -> aux ;
6498
6502
struct bpf_verifier_state * vstate = env -> cur_state ;
6499
6503
bool off_is_imm = tnum_is_const (off_reg -> var_off );
6500
6504
bool off_is_neg = off_reg -> smin_value < 0 ;
@@ -6523,8 +6527,8 @@ static int sanitize_ptr_alu(struct bpf_verifier_env *env,
6523
6527
/* In commit phase we narrow the masking window based on
6524
6528
* the observed pointer move after the simulated operation.
6525
6529
*/
6526
- alu_state = tmp_aux -> alu_state ;
6527
- alu_limit = abs (tmp_aux -> alu_limit - alu_limit );
6530
+ alu_state = info -> aux . alu_state ;
6531
+ alu_limit = abs (info -> aux . alu_limit - alu_limit );
6528
6532
} else {
6529
6533
alu_state = off_is_neg ? BPF_ALU_NEG_VALUE : 0 ;
6530
6534
alu_state |= off_is_imm ? BPF_ALU_IMMEDIATE : 0 ;
@@ -6685,7 +6689,7 @@ static int adjust_ptr_min_max_vals(struct bpf_verifier_env *env,
6685
6689
smin_ptr = ptr_reg -> smin_value , smax_ptr = ptr_reg -> smax_value ;
6686
6690
u64 umin_val = off_reg -> umin_value , umax_val = off_reg -> umax_value ,
6687
6691
umin_ptr = ptr_reg -> umin_value , umax_ptr = ptr_reg -> umax_value ;
6688
- struct bpf_insn_aux_data tmp_aux = {};
6692
+ struct bpf_sanitize_info info = {};
6689
6693
u8 opcode = BPF_OP (insn -> code );
6690
6694
u32 dst = insn -> dst_reg ;
6691
6695
int ret ;
@@ -6754,7 +6758,7 @@ static int adjust_ptr_min_max_vals(struct bpf_verifier_env *env,
6754
6758
6755
6759
if (sanitize_needed (opcode )) {
6756
6760
ret = sanitize_ptr_alu (env , insn , ptr_reg , off_reg , dst_reg ,
6757
- & tmp_aux , false);
6761
+ & info , false);
6758
6762
if (ret < 0 )
6759
6763
return sanitize_err (env , insn , ret , off_reg , dst_reg );
6760
6764
}
@@ -6895,7 +6899,7 @@ static int adjust_ptr_min_max_vals(struct bpf_verifier_env *env,
6895
6899
return - EACCES ;
6896
6900
if (sanitize_needed (opcode )) {
6897
6901
ret = sanitize_ptr_alu (env , insn , dst_reg , off_reg , dst_reg ,
6898
- & tmp_aux , true);
6902
+ & info , true);
6899
6903
if (ret < 0 )
6900
6904
return sanitize_err (env , insn , ret , off_reg , dst_reg );
6901
6905
}
0 commit comments