Re: [PATCH bpf-next v2 3/3] selftests/bpf: guarantee zero termination for veristat test buffers

[email protected]
Newsgroups org.kernel.vger.bpf
Message-ID <6142836b7397cc1eac282de8416547c479dc8b2efc514f2b3873db36ff00f5bf@mail.kernel.org>
> selftests/bpf: guarantee zero termination for veristat test buffers
>
> In veristat tests replace direct read() calls with calls to
> read_output() utility function, which:
> - guarantees that the input buffer is zero terminated;
> - asserts that read operation succeeded.
>
> Signed-off-by: Eduard Zingerman <[email protected]>

This looks like a bug fix rather than just a cleanup. The pre-existing
code called read() on a buffer that was never zero terminated, then passed
it to __CHECK_STR() which expands to strstr(). Because init_fixture() and
teardown_fixture() reuse the same malloc()'d buffer across subtests,
strstr() could match text from a previous run and report a false PASS, or
read past the buffer end.

Should this include a Fixes tag pointing to the commit that added the
veristat subtests with the unterminated read() calls?


---
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/31753097393
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.