Re: [PATCH bpf-next 1/2] selftests/bpf: fix for veristat file/prog filters processing

[email protected]
Newsgroups org.kernel.vger.bpf
Message-ID <1b98af79fa5ac4a50f74eb67b30fecba06a9990d9483fdead77176412536fda0@mail.kernel.org>
>     selftests/bpf: fix for veristat file/prog filters processing
>
>     At the moment veristat filtering behaves unexpectedly for the
>     following filter expression:
>
>       -f !file/prog
>
>     The expression rejects all programs with name 'prog', and all programs
>     in a file with name 'file'. This commit fixes the expression to
>     exclude only a program 'prog' from a file 'file'. Additionally,
>     the commit makes empty filters like '-f ""' or '-f "/"' and error.
>     Here is the filtering behaviour compared old versus new:
>
>     | filter   | file | prog | old verdict | new verdict |
>     |----------+------+------+-------------+-------------|
>     | !foo     | foo  | bar  | skipped     | skipped     |
>     | !foo     | bar  | foo  | skipped     | skipped     |
>     | !foo/bar | foo  | bar  | skipped     | skipped     |
>     | !foo/bar | foo  | buz  | skipped     | processed   | (!)
>     | !foo/bar | bar  | bar  | skipped     | processed   | (!)
>     | !foo/    | foo  | bar  | skipped     | skipped     |
>     | !foo/    | bar  | bar  | processed   | processed   |
>     | !/bar    | foo  | bar  | skipped     | skipped     |
>     | !/bar    | foo  | foo  | processed   | processed   |
>     | !/       | foo  | bar  | processed   | error       | (!)
>     | !        | foo  | bar  | processed   | error       | (!)
>     |----------+------+------+-------------+-------------|
>     | foo      | foo  | bar  | processed   | processed   |
>     | foo      | bar  | foo  | processed   | processed   |
>     | foo/bar  | foo  | bar  | processed   | processed   |
>     | foo/bar  | foo  | buz  | skipped     | skipped     |
>     | foo/bar  | bar  | bar  | skipped     | skipped     |
>     | foo/     | foo  | bar  | processed   | processed   |
>     | foo/     | bar  | bar  | skipped     | skipped     |
>     | /bar     | foo  | bar  | processed   | processed   |
>     | /bar     | foo  | foo  | skipped     | skipped     |
>     | /        | foo  | bar  | processed   | error       | (!)
>     |          | foo  | bar  | skipped     | error       | (!)
>
>     Signed-off-by: Eduard Zingerman <[email protected]>

This looks like a bug fix for existing tooling. The changelog table marks
four behavior rows with '(!)', showing the OR-matching bug being fixed and
empty filters now being rejected. Should this include a Fixes: tag?

The broken semantics - deny filter matching on file OR prog independently,
and empty filters being silently accepted - were introduced when the separate
should_process_file() and should_process_prog() helpers were merged into
should_process_file_prog():

  Fixes: 10b1b3f3e56a ("selftests/bpf: consolidate and improve file/prog filtering in veristat")


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/31521742364
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.