Skip to content

Commit c5bcc8c

Browse files
Gbell26Alexei Starovoitov
authored andcommitted
selftests/bpf: test_verifier verbose causes erroneous failures
When running test_verifier with the -v flag and a test with `expected_ret==VERBOSE_ACCEPT`, the opts.log_level is unintentionally overwritten because the verbose flag takes precedence. This leads to a mismatch in the expected and actual contents of bpf_vlog, causing tests to fail incorrectly. Reorder the conditional logic that sets opts.log_level to preserve the expected log level and prevent it from being overridden by -v. Signed-off-by: Gregory Bell <[email protected]> Link: https://lore.kernel.org/r/182bf00474f817c99f968a9edb119882f62be0f8.1747058195.git.grbell@redhat.com Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 7220eab commit c5bcc8c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tools/testing/selftests/bpf/test_verifier.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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)