@@ -35,6 +35,10 @@ int save_state_in_oracle(struct bpf_verifier_env *env, int insn_idx)
3535 struct bpf_insn_aux_data * aux = cur_aux (env );
3636 struct bpf_oracle_state_list * new_sl ;
3737
38+ if (env -> subprog_cnt > 1 )
39+ /* Skip the oracle if subprogs are used. */
40+ return 0 ;
41+
3842 if (!aux -> oracle_states ) {
3943 aux -> oracle_states = kmalloc (sizeof (struct list_head ), GFP_KERNEL_ACCOUNT );
4044 if (!aux -> oracle_states )
@@ -144,11 +148,14 @@ struct bpf_prog *patch_oracle_check_insn(struct bpf_verifier_env *env, struct bp
144148 struct bpf_insn_aux_data * aux = & env -> insn_aux_data [i ];
145149 struct list_head * head = aux -> oracle_states ;
146150 struct bpf_insn * insn_buf = env -> insn_buf ;
147- struct bpf_prog * new_prog ;
151+ struct bpf_prog * new_prog = env -> prog ;
152+ if (env -> subprog_cnt > 1 )
153+ /* Skip the oracle if subprogs are used. */
154+ goto noop ;
148155 int num_oracle_states = list_count_nodes (head );
149156 int err ;
150157 if (!num_oracle_states )
151- return NULL ;
158+ goto noop ;
152159 struct bpf_map * inner_map = create_inner_oracle_map (num_oracle_states );
153160 if (IS_ERR (inner_map ))
154161 return (void * )inner_map ;
@@ -179,6 +186,10 @@ struct bpf_prog *patch_oracle_check_insn(struct bpf_verifier_env *env, struct bp
179186 return ERR_PTR (err );
180187
181188 return new_prog ;
189+
190+ noop :
191+ * cnt = 1 ;
192+ return new_prog ;
182193}
183194
184195int populate_oracle_map (struct bpf_verifier_env * env , struct bpf_map * oracle_map )
@@ -238,7 +249,8 @@ struct bpf_map *create_oracle_map(struct bpf_verifier_env *env)
238249 struct bpf_map * map = NULL , * inner_map ;
239250 int err ;
240251
241- if (env -> num_prune_points == 0 )
252+ if (env -> num_prune_points == 0 || env -> subprog_cnt > 1 )
253+ /* Skip the oracle if subprogs are used. */
242254 return map ;
243255
244256 union bpf_attr map_attr = {
0 commit comments