@@ -2848,12 +2848,6 @@ static int sanitize_ptr_alu(struct bpf_verifier_env *env,
2848
2848
alu_state |= off_is_imm ? BPF_ALU_IMMEDIATE : 0 ;
2849
2849
alu_state |= ptr_is_dst_reg ?
2850
2850
BPF_ALU_SANITIZE_SRC : BPF_ALU_SANITIZE_DST ;
2851
-
2852
- /* Limit pruning on unknown scalars to enable deep search for
2853
- * potential masking differences from other program paths.
2854
- */
2855
- if (!off_is_imm )
2856
- env -> explore_alu_limits = true;
2857
2851
}
2858
2852
2859
2853
err = update_alu_sanitation_state (aux , alu_state , alu_limit );
@@ -4784,8 +4778,8 @@ static bool check_ids(u32 old_id, u32 cur_id, struct bpf_id_pair *idmap)
4784
4778
}
4785
4779
4786
4780
/* Returns true if (rold safe implies rcur safe) */
4787
- static bool regsafe (struct bpf_verifier_env * env , struct bpf_reg_state * rold ,
4788
- struct bpf_reg_state * rcur , struct bpf_id_pair * idmap )
4781
+ static bool regsafe (struct bpf_reg_state * rold , struct bpf_reg_state * rcur ,
4782
+ struct bpf_id_pair * idmap )
4789
4783
{
4790
4784
bool equal ;
4791
4785
@@ -4811,8 +4805,6 @@ static bool regsafe(struct bpf_verifier_env *env, struct bpf_reg_state *rold,
4811
4805
return false;
4812
4806
switch (rold -> type ) {
4813
4807
case SCALAR_VALUE :
4814
- if (env -> explore_alu_limits )
4815
- return false;
4816
4808
if (rcur -> type == SCALAR_VALUE ) {
4817
4809
/* new val must satisfy old val knowledge */
4818
4810
return range_within (rold , rcur ) &&
@@ -4889,8 +4881,9 @@ static bool regsafe(struct bpf_verifier_env *env, struct bpf_reg_state *rold,
4889
4881
return false;
4890
4882
}
4891
4883
4892
- static bool stacksafe (struct bpf_verifier_env * env , struct bpf_func_state * old ,
4893
- struct bpf_func_state * cur , struct bpf_id_pair * idmap )
4884
+ static bool stacksafe (struct bpf_func_state * old ,
4885
+ struct bpf_func_state * cur ,
4886
+ struct bpf_id_pair * idmap )
4894
4887
{
4895
4888
int i , spi ;
4896
4889
@@ -4932,8 +4925,9 @@ static bool stacksafe(struct bpf_verifier_env *env, struct bpf_func_state *old,
4932
4925
continue ;
4933
4926
if (old -> stack [spi ].slot_type [0 ] != STACK_SPILL )
4934
4927
continue ;
4935
- if (!regsafe (env , & old -> stack [spi ].spilled_ptr ,
4936
- & cur -> stack [spi ].spilled_ptr , idmap ))
4928
+ if (!regsafe (& old -> stack [spi ].spilled_ptr ,
4929
+ & cur -> stack [spi ].spilled_ptr ,
4930
+ idmap ))
4937
4931
/* when explored and current stack slot are both storing
4938
4932
* spilled registers, check that stored pointers types
4939
4933
* are the same as well.
@@ -4982,11 +4976,10 @@ static bool func_states_equal(struct bpf_verifier_env *env, struct bpf_func_stat
4982
4976
4983
4977
memset (env -> idmap_scratch , 0 , sizeof (env -> idmap_scratch ));
4984
4978
for (i = 0 ; i < MAX_BPF_REG ; i ++ )
4985
- if (!regsafe (env , & old -> regs [i ], & cur -> regs [i ],
4986
- env -> idmap_scratch ))
4979
+ if (!regsafe (& old -> regs [i ], & cur -> regs [i ], env -> idmap_scratch ))
4987
4980
return false;
4988
4981
4989
- if (!stacksafe (env , old , cur , env -> idmap_scratch ))
4982
+ if (!stacksafe (old , cur , env -> idmap_scratch ))
4990
4983
return false;
4991
4984
4992
4985
return true;
0 commit comments