bpf: fix maximum stack depth tracking logic
authorAlexei Starovoitov <ast@kernel.org>
Mon, 25 Dec 2017 21:15:40 +0000 (13:15 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 27 Dec 2017 17:36:23 +0000 (18:36 +0100)
commit70a87ffea8acc390ae315fa1930e849f656bdb88
tree7a7ce271921b6767965e7c73b30cb4ffb643b404
parent6b80ad299208b44ba33cb6df80bdaa3f63cf03e2
bpf: fix maximum stack depth tracking logic

Instead of computing max stack depth for current call chain
during the main verifier pass track stack depth of each
function independently and after do_check() is done do
another pass over all instructions analyzing depth
of all possible call stacks.

Fixes: f4d7e40a5b71 ("bpf: introduce function calls (verification)")
Reported-by: Jann Horn <jannh@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
include/linux/bpf_verifier.h
kernel/bpf/verifier.c