summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDaniel Borkmann <daniel@iogearbox.net>2019-04-03 18:39:05 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-04-20 09:15:08 +0200
commit6a42c49482db5ab565a9dabb1642ff64ae0f45b7 (patch)
tree8e1572221b33e9ba53707cffe1099fd877262362 /include
parentbpf: fix stack state printing in verifier log (diff)
downloadlinux-stable-6a42c49482db5ab565a9dabb1642ff64ae0f45b7.tar.xz
linux-stable-6a42c49482db5ab565a9dabb1642ff64ae0f45b7.zip
bpf: move {prev_,}insn_idx into verifier env
commit c08435ec7f2bc8f4109401f696fd55159b4b40cb upstream. Move prev_insn_idx and insn_idx from the do_check() function into the verifier environment, so they can be read inside the various helper functions for handling the instructions. It's easier to put this into the environment rather than changing all call-sites only to pass it along. insn_idx is useful in particular since this later on allows to hold state in env->insn_aux_data[env->insn_idx]. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Vallish Vaidyeshwara <vallish@amazon.com> [Backported to 4.14 by sblbir] Signed-off-by: Balbir Singh <sblbir@amzn.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/bpf_verifier.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h
index 0fc3d9afb8bf..3149a01d0f58 100644
--- a/include/linux/bpf_verifier.h
+++ b/include/linux/bpf_verifier.h
@@ -134,6 +134,8 @@ struct bpf_ext_analyzer_ops {
* one verifier_env per bpf_check() call
*/
struct bpf_verifier_env {
+ u32 insn_idx;
+ u32 prev_insn_idx;
struct bpf_prog *prog; /* eBPF program being verified */
struct bpf_verifier_stack_elem *head; /* stack of verifier states to be processed */
int stack_size; /* number of states to be processed */