MCPcopy Create free account
hub / github.com/F-Stack/f-stack / prune_eval_state

Function prune_eval_state

dpdk/lib/bpf/bpf_validate.c:2334–2364  ·  view source on GitHub ↗

* check did we already evaluated that path and can it be pruned that time. */

Source from the content-addressed store, hash-verified

2332 * check did we already evaluated that path and can it be pruned that time.
2333 */
2334static int
2335prune_eval_state(struct bpf_verifier *bvf, const struct inst_node *node,
2336 struct inst_node *next)
2337{
2338 int32_t rc;
2339 struct bpf_eval_state *safe;
2340
2341 rc = INT32_MIN;
2342 SLIST_FOREACH(safe, &next->evst.safe, next) {
2343 rc = cmp_eval_state(safe, bvf->evst);
2344 if (rc >= 0)
2345 break;
2346 }
2347
2348 rc = (rc >= 0) ? 0 : -1;
2349
2350 /*
2351 * current state doesn't match any safe states,
2352 * so no prunning is possible right now,
2353 * track current state for future references.
2354 */
2355 if (rc != 0)
2356 save_start_eval_state(bvf, next);
2357
2358 RTE_BPF_LOG(DEBUG,
2359 "%s(bvf=%p,node=%u,next=%u) returns %d, "
2360 "next->evst.start=%p, next->evst.nb_safe=%u\n",
2361 __func__, bvf, get_node_idx(bvf, node), get_node_idx(bvf, next), rc, next->evst.start,
2362 next->evst.nb_safe);
2363 return rc;
2364}
2365
2366/* Do second pass through CFG and try to evaluate instructions
2367 * via each possible path. The verifier will try all paths, tracking types of

Callers 1

evaluateFunction · 0.85

Calls 3

cmp_eval_stateFunction · 0.85
save_start_eval_stateFunction · 0.85
get_node_idxFunction · 0.85

Tested by

no test coverage detected