bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/2] bpf: remove incorrect 'verifier bug' warning
@ 2019-03-20 12:57 Paul Chaignon
  2019-03-20 12:58 ` [PATCH bpf-next 1/2] " Paul Chaignon
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Paul Chaignon @ 2019-03-20 12:57 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, netdev, bpf
  Cc: xiao.han, paul.chaignon, Martin KaFai Lau, Song Liu, Yonghong Song

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.
The first patch implements the conservative option and rejects such code;
the second adds a test case.

Paul Chaignon (2):
  bpf: remove incorrect 'verifier bug' warning
  selftests/bpf: test case for invalid call stack in dead code

 kernel/bpf/verifier.c                        |  5 +--
 tools/testing/selftests/bpf/verifier/calls.c | 38 ++++++++++++++++++++
 2 files changed, 41 insertions(+), 2 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-03-26 20:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-20 12:57 [PATCH bpf-next 0/2] bpf: remove incorrect 'verifier bug' warning Paul Chaignon
2019-03-20 12:58 ` [PATCH bpf-next 1/2] " Paul Chaignon
2019-03-20 12:58 ` [PATCH bpf-next 2/2] selftests/bpf: test case for invalid call stack in dead code Paul Chaignon
2019-03-20 23:31 ` [PATCH bpf-next 0/2] bpf: remove incorrect 'verifier bug' warning Yonghong Song
2019-03-21  9:33   ` Paul Chaignon
2019-03-26 20:07     ` Alexei Starovoitov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).