Skip to content

Commit 149e0cf

Browse files
author
Alexei Starovoitov
committed
Merge branch 'fix-verifier-test-failures-in-verbose-mode'
Gregory Bell says: ==================== Fix verifier test failures in verbose mode This patch series fixes two issues that cause false failures in the BPF verifier test suite when run with verbose output (`-v`). The following tests fail only when running the test_verifier in verbose. This leads to inconsistent results across verbose and non-verbose runs. Patch 1 addresses an issue where the verbose flag (`-v`) unintentionally overrides the `opts.log_level`, leading to incorrect contents when checking bpf_vlog in tests with `expected_ret == VERBOSE_ACCEPT`. This occurs when running verbose with `-v` but not `-vv` Patch 2 increases the size of the `bpf_vlog[]` buffer to prevent truncation of large verifier logs, which was causing failures in several scale and 64-bit immediate tests. Before patches: ./test_verifier | grep FAIL Summary: 790 PASSED, 0 SKIPPED, 0 FAILED ./test_verifier -v | grep FAIL Summary: 782 PASSED, 0 SKIPPED, 8 FAILED ./test_verifier -vv | grep FAIL Summary: 787 PASSED, 0 SKIPPED, 3 FAILED After patches: ./test_verifier -v | grep FAIL Summary: 790 PASSED, 0 SKIPPED, 0 FAILED ./test_verifier -vv | grep FAIL Summary: 790 PASSED, 0 SKIPPED, 0 FAILED These fixes improve test reliability and ensure consistent behavior across verbose and non-verbose runs. ==================== Tested-by: Eduard Zingerman <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
2 parents 7220eab + af8a512 commit 149e0cf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tools/testing/selftests/bpf/test_verifier.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ static __u32 btf_raw_types[] = {
734734
BTF_MEMBER_ENC(71, 13, 128), /* struct prog_test_member __kptr *ptr; */
735735
};
736736

737-
static char bpf_vlog[UINT_MAX >> 8];
737+
static char bpf_vlog[UINT_MAX >> 5];
738738

739739
static int load_btf_spec(__u32 *types, int types_len,
740740
const char *strings, int strings_len)
@@ -1559,10 +1559,10 @@ static void do_test_single(struct bpf_test *test, bool unpriv,
15591559
test->errstr_unpriv : test->errstr;
15601560

15611561
opts.expected_attach_type = test->expected_attach_type;
1562-
if (verbose)
1563-
opts.log_level = verif_log_level | 4; /* force stats */
1564-
else if (expected_ret == VERBOSE_ACCEPT)
1562+
if (expected_ret == VERBOSE_ACCEPT)
15651563
opts.log_level = 2;
1564+
else if (verbose)
1565+
opts.log_level = verif_log_level | 4; /* force stats */
15661566
else
15671567
opts.log_level = DEFAULT_LIBBPF_LOG_LEVEL;
15681568
opts.prog_flags = pflags;

0 commit comments

Comments
 (0)