]> git.hungrycats.org Git - linux/commitdiff
bpf: fix stack state printing in verifier log
authorAlexei Starovoitov <ast@fb.com>
Fri, 1 Dec 2017 05:31:35 +0000 (21:31 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 19 Mar 2018 08:09:54 +0000 (09:09 +0100)
[ Upstream commit 12a3cc8424fe1237aaeb982dec4f0914ddd22f3e ]

fix incorrect stack state prints in print_verifier_state()

Fixes: 638f5b90d460 ("bpf: reduce verifier memory consumption")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/bpf/verifier.c

index 7125ddbb24df3ec5e1809352c9bd6ac8de9ef208..6b4a72e5f87498bc635de1a90154b0ccd8c7c324 100644 (file)
@@ -279,7 +279,7 @@ static void print_verifier_state(struct bpf_verifier_env *env,
        for (i = 0; i < state->allocated_stack / BPF_REG_SIZE; i++) {
                if (state->stack[i].slot_type[0] == STACK_SPILL)
                        verbose(env, " fp%d=%s",
-                               -MAX_BPF_STACK + i * BPF_REG_SIZE,
+                               (-i - 1) * BPF_REG_SIZE,
                                reg_type_str[state->stack[i].spilled_ptr.type]);
        }
        verbose(env, "\n");