Skip to content

bpf: remove incorrect 'verifier bug' warning

Paul Chaignon bpf netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2bpf: remove incorrect 'verifier bug' warningkernel/bpf/verifier.c+3 -20 replies
2/2selftests/bpf: test case for invalid call stack in dead codetools/testing/selftests/bpf/verifier/calls.c+38 -00 replies

Reviews trailers per patch

None of the 2 patches has a Reviewed-by or Acked-by.

PatchXiao Han
1/2T-b
2/2T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH bpf-next 0/2] 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. 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(-)
Signature · 1 line
2.17.1