selftest/bpf: Testing for multiple logs on REJECT
authorAndrei Matei <andreimatei1@gmail.com>
Sat, 30 Jan 2021 22:01:50 +0000 (17:01 -0500)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 3 Feb 2021 21:01:25 +0000 (22:01 +0100)
commit060fd1035880dd466607d1c279ca913dd1f96916
tree67224d24637f77e6f5271657528d0a9c88586f25
parent1132b9987a3f6c7c396633d5a675075911f1ce32
selftest/bpf: Testing for multiple logs on REJECT

This patch adds support to verifier tests to check for a succession of
verifier log messages on program load failure. This makes the errstr
field work uniformly across REJECT and VERBOSE_ACCEPT checks.

This patch also increases the maximum size of a message in the series of
messages to test from 80 chars to 200 chars. This is in order to keep
existing tests working, which sometimes test for messages larger than 80
chars (which was accepted in the REJECT case, when testing for a single
message, but not in the VERBOSE_ACCEPT case, when testing for possibly
multiple messages).

And example of such a long, checked message is in bounds.c: "R1 has
unknown scalar with mixed signed bounds, pointer arithmetic with it
prohibited for !root"

Signed-off-by: Andrei Matei <andreimatei1@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Song Liu <songliubraving@fb.com>
Link: https://lore.kernel.org/bpf/20210130220150.59305-1-andreimatei1@gmail.com
tools/testing/selftests/bpf/test_verifier.c