Computing min_frame in find_loop and using it to detect recursion means we don't need to play games with per-frame parent pointers, and can instead have a single parent pointer in the verifier_state.
Signed-off-by: Edward Cree <ec...@solarflare.com> --- include/linux/bpf_verifier.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h index ee034232fbd6..0320df10555b 100644 --- a/include/linux/bpf_verifier.h +++ b/include/linux/bpf_verifier.h @@ -121,12 +121,6 @@ struct bpf_func_state { */ u32 subprogno; - /* loop detection; points into an explored_state */ - struct bpf_func_state *parent; - /* These flags are only meaningful in an explored_state, not cur_state */ - bool bounded_loop, conditional; - int live_children; - /* should be second to last. See copy_func_state() */ int allocated_stack; struct bpf_stack_state *stack; @@ -137,6 +131,12 @@ struct bpf_verifier_state { /* call stack tracking */ struct bpf_func_state *frame[MAX_CALL_FRAMES]; u32 curframe; + + /* loop detection; points into an explored_state */ + struct bpf_verifier_state *parent; + /* These flags are only meaningful in an explored_state, not cur_state */ + bool bounded_loop, conditional; + int live_children; }; /* linked list of verifier states used to prune search */