bpf: add upper complexity limit to verifier log
authorDaniel Borkmann <daniel@iogearbox.net>
Sat, 20 Jan 2018 00:24:36 +0000 (01:24 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 20 Jan 2018 02:37:00 +0000 (18:37 -0800)
Given the limit could potentially get further adjustments in the
future, add it to the log so it becomes obvious what the current
limit is w/o having to check the source first. This may also be
helpful for debugging complexity related issues on kernels that
backport from upstream.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/verifier.c

index 5eeb200e82c4378395d8ff319c2d2ffe7ef89a2c..caae4955fbdb786eb7bb6ea15821c70f50aaab40 100644 (file)
@@ -4810,7 +4810,8 @@ process_bpf_exit:
                insn_idx++;
        }
 
-       verbose(env, "processed %d insns, stack depth ", insn_processed);
+       verbose(env, "processed %d insns (limit %d), stack depth ",
+               insn_processed, BPF_COMPLEXITY_LIMIT_INSNS);
        for (i = 0; i < env->subprog_cnt + 1; i++) {
                u32 depth = env->subprog_stack_depth[i];