@@ -5436,7 +5436,6 @@ enum {
5436
5436
BRANCH = 2 ,
5437
5437
};
5438
5438
5439
- #define STATE_LIST_MARK ((struct bpf_verifier_state_list *) -1L)
5440
5439
static struct bpf_verifier_state_list * * explored_state (
5441
5440
struct bpf_verifier_env * env ,
5442
5441
int idx )
@@ -5446,7 +5445,7 @@ static struct bpf_verifier_state_list **explored_state(
5446
5445
5447
5446
static void init_explored_state (struct bpf_verifier_env * env , int idx )
5448
5447
{
5449
- env -> explored_states [idx ] = STATE_LIST_MARK ;
5448
+ env -> insn_aux_data [idx ]. prune_point = true ;
5450
5449
}
5451
5450
5452
5451
/* t, w, e - match pseudo-code above:
@@ -6018,10 +6017,7 @@ static void clean_live_states(struct bpf_verifier_env *env, int insn,
6018
6017
int i ;
6019
6018
6020
6019
sl = * explored_state (env , insn );
6021
- if (!sl )
6022
- return ;
6023
-
6024
- while (sl != STATE_LIST_MARK ) {
6020
+ while (sl ) {
6025
6021
if (sl -> state .curframe != cur -> curframe )
6026
6022
goto next ;
6027
6023
for (i = 0 ; i <= cur -> curframe ; i ++ )
@@ -6376,18 +6372,18 @@ static int is_state_visited(struct bpf_verifier_env *env, int insn_idx)
6376
6372
struct bpf_verifier_state * cur = env -> cur_state , * new ;
6377
6373
int i , j , err , states_cnt = 0 ;
6378
6374
6379
- pprev = explored_state (env , insn_idx );
6380
- sl = * pprev ;
6381
-
6382
- if (!sl )
6375
+ if (!env -> insn_aux_data [insn_idx ].prune_point )
6383
6376
/* this 'insn_idx' instruction wasn't marked, so we will not
6384
6377
* be doing state search here
6385
6378
*/
6386
6379
return 0 ;
6387
6380
6381
+ pprev = explored_state (env , insn_idx );
6382
+ sl = * pprev ;
6383
+
6388
6384
clean_live_states (env , insn_idx , cur );
6389
6385
6390
- while (sl != STATE_LIST_MARK ) {
6386
+ while (sl ) {
6391
6387
if (states_equal (env , & sl -> state , cur )) {
6392
6388
sl -> hit_cnt ++ ;
6393
6389
/* reached equivalent register/stack state,
@@ -8145,13 +8141,12 @@ static void free_states(struct bpf_verifier_env *env)
8145
8141
for (i = 0 ; i < env -> prog -> len ; i ++ ) {
8146
8142
sl = env -> explored_states [i ];
8147
8143
8148
- if (sl )
8149
- while (sl != STATE_LIST_MARK ) {
8150
- sln = sl -> next ;
8151
- free_verifier_state (& sl -> state , false);
8152
- kfree (sl );
8153
- sl = sln ;
8154
- }
8144
+ while (sl ) {
8145
+ sln = sl -> next ;
8146
+ free_verifier_state (& sl -> state , false);
8147
+ kfree (sl );
8148
+ sl = sln ;
8149
+ }
8155
8150
}
8156
8151
8157
8152
kvfree (env -> explored_states );
0 commit comments