diff mbox series

[RFC,bpf-next,10/12] bpf/verifier: parent state pointer is not per-frame

Message ID 303a5d8c-beb6-5a87-e6a8-3f19adabbb88@solarflare.com
State RFC, archived
Delegated to: BPF Maintainers
Headers show
Series bounded loops for eBPF | expand

Commit Message

Edward Cree Feb. 23, 2018, 5:42 p.m. UTC
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 <ecree@solarflare.com>
---
 include/linux/bpf_verifier.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
diff mbox series

Patch

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 */