Merge https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next
[linux-2.6-microblaze.git] / include / linux / bpf_verifier.h
index e8439f6..2e3bad8 100644 (file)
@@ -299,7 +299,7 @@ struct bpf_verifier_state {
         * If is_state_visited() sees a state with branches > 0 it means
         * there is a loop. If such state is exactly equal to the current state
         * it's an infinite loop. Note states_equal() checks for states
-        * equvalency, so two states being 'states_equal' does not mean
+        * equivalency, so two states being 'states_equal' does not mean
         * infinite loop. The exact comparison is provided by
         * states_maybe_looping() function. It's a stronger pre-check and
         * much faster than states_equal().
@@ -344,6 +344,14 @@ struct bpf_verifier_state_list {
        int miss_cnt, hit_cnt;
 };
 
+struct bpf_loop_inline_state {
+       unsigned int initialized:1; /* set to true upon first entry */
+       unsigned int fit_for_inline:1; /* true if callback function is the same
+                                       * at each call and flags are always zero
+                                       */
+       u32 callback_subprogno; /* valid when fit_for_inline is true */
+};
+
 /* Possible states for alu_state member. */
 #define BPF_ALU_SANITIZE_SRC           (1U << 0)
 #define BPF_ALU_SANITIZE_DST           (1U << 1)
@@ -373,6 +381,10 @@ struct bpf_insn_aux_data {
                                u32 mem_size;   /* mem_size for non-struct typed var */
                        };
                } btf_var;
+               /* if instruction is a call to bpf_loop this field tracks
+                * the state of the relevant registers to make decision about inlining
+                */
+               struct bpf_loop_inline_state loop_inline_state;
        };
        u64 map_key_state; /* constant (32 bit) key tracking for maps */
        int ctx_field_size; /* the ctx field size for load insn, maybe 0 */