From: sashiko-bot@kernel.org
To: "Emil Tsalapatis" <emil@etsalapatis.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v9 8/8] selftests/bpf: Reuse stderr parsing for libarena ASAN tests
Date: Sun, 26 Apr 2026 21:38:21 +0000 [thread overview]
Message-ID: <20260426213821.AA8F3C2BCAF@smtp.kernel.org> (raw)
In-Reply-To: <20260426190338.4615-9-emil@etsalapatis.com>
Sashiko AI review found 2 potential issue(s):
- [Low] Unnecessary export of `free_msgs` to the global namespace.
- [Low] Use of a magic number for the BPF stream ID.
--
commit 49cffc0bea9678ea2577c634e093c46121bf87fd
Author: Emil Tsalapatis <emil@etsalapatis.com>
selftests/bpf: Reuse stderr parsing for libarena ASAN tests
This commit adds code to directly test the output of libarena ASAN tests.
It reuses testing infrastructure originally for BPF streams to verify that
ASAN emits call stacks when memory errors occur.
> diff --git a/tools/testing/selftests/bpf/test_loader.c b/tools/testing/selftests/bpf/test_loader.c
> index c4c34cae6102..ee637809a1d4 100644
> --- a/tools/testing/selftests/bpf/test_loader.c
> +++ b/tools/testing/selftests/bpf/test_loader.c
> @@ -93,7 +93,7 @@ void test_loader_fini(struct test_loader *tester)
> free(tester->log_buf);
> }
>
> -static void free_msgs(struct expected_msgs *msgs)
> +void free_msgs(struct expected_msgs *msgs)
Are there any callers outside of test_loader.c that need this function?
It appears the newly added verify_test_stderr() encapsulates the cleanup
internally by calling free_test_spec(), leaving free_msgs() without any
external callers. Could this function remain static to avoid unnecessary
namespace pollution?
[ ... ]
> @@ -789,6 +789,43 @@ static void emit_stderr(const char *stderr, bool force)
> fprintf(stdout, "STDERR:\n=============\n%s=============\n", stderr);
> }
>
> +static void verify_stderr(int prog_fd, struct expected_msgs *msgs)
> +{
> + LIBBPF_OPTS(bpf_prog_stream_read_opts, ropts);
> + char *buf;
> + int ret;
> +
> + if (!msgs->cnt)
> + return;
> +
> + buf = malloc(TEST_LOADER_LOG_BUF_SZ);
> + if (!ASSERT_OK_PTR(buf, "malloc"))
> + return;
> +
> + ret = bpf_prog_stream_read(prog_fd, 2, buf, TEST_LOADER_LOG_BUF_SZ - 1,
> + &ropts);
Would it be better to use the BPF_STREAM_STDERR macro here instead of
hardcoding the value 2?
Using the macro defined in include/uapi/linux/bpf.h might improve
readability and stay consistent with other stream testing code.
[ ... ]
> diff --git a/tools/testing/selftests/bpf/test_progs.h b/tools/testing/selftests/bpf/test_progs.h
> index 1a44467f4310..37955a8ad385 100644
> --- a/tools/testing/selftests/bpf/test_progs.h
> +++ b/tools/testing/selftests/bpf/test_progs.h
> @@ -563,5 +563,7 @@ struct expected_msgs {
>
> void validate_msgs(const char *log_buf, struct expected_msgs *msgs,
> void (*emit_fn)(const char *buf, bool force));
> +void free_msgs(struct expected_msgs *msgs);
If free_msgs() can remain static, should this declaration be removed?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260426190338.4615-1-emil@etsalapatis.com?part=8
next prev parent reply other threads:[~2026-04-26 21:38 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-26 19:03 [PATCH bpf-next v9 0/8] Introduce arena library and runtime Emil Tsalapatis
2026-04-26 19:03 ` [PATCH bpf-next v9 1/8] selftests/bpf: Add ifdef guard for WRITE_ONCE macro in bpf_atomic.h Emil Tsalapatis
2026-04-26 19:03 ` [PATCH bpf-next v9 2/8] selftests/bpf: Add basic libarena scaffolding Emil Tsalapatis
2026-04-26 19:34 ` sashiko-bot
2026-04-26 19:03 ` [PATCH bpf-next v9 3/8] selftests/bpf: Move arena-related headers into libarena Emil Tsalapatis
2026-04-26 19:03 ` [PATCH bpf-next v9 4/8] selftests/bpf: Add arena ASAN runtime to libarena Emil Tsalapatis
2026-04-26 20:12 ` sashiko-bot
2026-04-26 19:03 ` [PATCH bpf-next v9 5/8] selftests/bpf: Add ASAN support for libarena selftests Emil Tsalapatis
2026-04-26 19:33 ` bot+bpf-ci
2026-04-26 20:28 ` sashiko-bot
2026-04-26 19:03 ` [PATCH bpf-next v9 6/8] selftests/bpf: Add buddy allocator for libarena Emil Tsalapatis
2026-04-26 19:46 ` bot+bpf-ci
2026-04-26 20:54 ` sashiko-bot
2026-04-26 19:03 ` [PATCH bpf-next v9 7/8] selftests/bpf: Add selftests for libarena buddy allocator Emil Tsalapatis
2026-04-26 21:09 ` sashiko-bot
2026-04-26 19:03 ` [PATCH bpf-next v9 8/8] selftests/bpf: Reuse stderr parsing for libarena ASAN tests Emil Tsalapatis
2026-04-26 19:46 ` bot+bpf-ci
2026-04-26 21:38 ` sashiko-bot [this message]
2026-04-27 1:20 ` [PATCH bpf-next v9 0/8] Introduce arena library and runtime patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260426213821.AA8F3C2BCAF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=emil@etsalapatis.com \
--cc=sashiko@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox