]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: remove incorrect 'verifier bug' warning
authorPaul Chaignon <paul.chaignon@orange.com>
Wed, 20 Mar 2019 12:58:27 +0000 (13:58 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 26 Mar 2019 20:02:16 +0000 (13:02 -0700)
commit5d47d9488b760f6c804b065c970ce1ea1ca6ea2c
tree468b520b36506fade213dc64431cf18cf10c6cc5
parente7106d11fc0bb3fb22904ba1fbb7a83d5acd6bbb
bpf: remove incorrect 'verifier bug' warning

The BPF verifier checks the maximum number of call stack frames twice,
first in the main CFG traversal (do_check) and then in a subsequent
traversal (check_max_stack_depth).  If the second check fails, it logs a
'verifier bug' warning and errors out, as the number of call stack frames
should have been verified already.

However, the second check may fail without indicating a verifier bug: if
the excessive function calls reside in dead code, the main CFG traversal
may not visit them; the subsequent traversal visits all instructions,
including dead code.

This case raises the question of how invalid dead code should be treated.
This patch implements the conservative option and rejects such code.

Signed-off-by: Paul Chaignon <paul.chaignon@orange.com>
Tested-by: Xiao Han <xiao.han@orange.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/verifier.c