]> git.baikalelectronics.ru Git - kernel.git/commit
bpf, selftests: Adjust few selftest outcomes wrt unreachable code
authorDaniel Borkmann <daniel@iogearbox.net>
Mon, 31 May 2021 12:34:24 +0000 (12:34 +0000)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 14 Jun 2021 21:06:38 +0000 (23:06 +0200)
commit973377ffe8148180b2651825b92ae91988141b05
tree363aad5d7260456848f4ea67f781db338a2afc6d
parent9183671af6dbf60a1219371d4ed73e23f43b49db
bpf, selftests: Adjust few selftest outcomes wrt unreachable code

In almost all cases from test_verifier that have been changed in here, we've
had an unreachable path with a load from a register which has an invalid
address on purpose. This was basically to make sure that we never walk this
path and to have the verifier complain if it would otherwise. Change it to
match on the right error for unprivileged given we now test these paths
under speculative execution.

There's one case where we match on exact # of insns_processed. Due to the
extra path, this will of course mismatch on unprivileged. Thus, restrict the
test->insn_processed check to privileged-only.

In one other case, we result in a 'pointer comparison prohibited' error. This
is similarly due to verifying an 'invalid' branch where we end up with a value
pointer on one side of the comparison.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/test_verifier.c
tools/testing/selftests/bpf/verifier/and.c
tools/testing/selftests/bpf/verifier/bounds.c
tools/testing/selftests/bpf/verifier/dead_code.c
tools/testing/selftests/bpf/verifier/jmp32.c
tools/testing/selftests/bpf/verifier/jset.c
tools/testing/selftests/bpf/verifier/unpriv.c
tools/testing/selftests/bpf/verifier/value_ptr_arith.c