From: sashiko-bot@kernel.org
To: "Kumar Kartikeya Dwivedi" <memxor@gmail.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v2 1/3] bpf: Show more useful info in stack depth stats
Date: Sun, 02 Aug 2026 23:04:34 +0000 [thread overview]
Message-ID: <20260802230435.7F4331F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260802225209.2511758-2-memxor@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The commit changes the verifier's 'stack depth' log format from a single-line format (`stack depth %d+%d...+%d max %d`) to a multi-line format (`stack depth max %d` followed by per-subprogram lines). However, it fails to update the `veristat` tool in the BPF selftests, which relies on parsing the old format to collect stack depth statistics. When `veristat` attempts to parse the new verifier log, the hardcoded `sscanf` string (`"stack depth %511s max %ld"`) matches only the first word (`"max"`) but fails on the rest, leading to broken and unpopulated `STACK` and `MAX_STACK` metrics.
--
--- Patch [1]: [PATCH bpf-next v2 1/3] bpf: Show more useful info in stack depth stats ---
commit f4a761d5dad941fea12558fab4093ec6ef3e52da
Author: Kumar Kartikeya Dwivedi <memxor@gmail.com>
bpf: Show more useful info in stack depth stats
This commit updates the BPF verifier's stack depth statistics logging to print
the maximum stack depth and each subprogram's stack depth on separate lines.
It also updates various selftests to match the new output format.
> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> index e6f35f4e715b6..74a92036d84e7 100644
> --- a/kernel/bpf/verifier.c
> +++ b/kernel/bpf/verifier.c
> @@ -18703,10 +18703,15 @@ static void print_verification_stats(struct bpf_verifier_env *env)
> if (env->log.level & BPF_LOG_STATS) {
> verbose(env, "verification time %lld usec\n",
> div_u64(env->verification_time, 1000));
> - verbose(env, "stack depth %d", env->subprog_info[0].stack_depth);
> - for (i = 1; i < subprog_cnt; i++)
> - verbose(env, "+%d", env->subprog_info[i].stack_depth);
> - verbose(env, " max %d\n", env->max_stack_depth);
> + verbose(env, "stack depth max %d\n", env->max_stack_depth);
> + for (i = 0; i < subprog_cnt; i++) {
> + const char *name = env->subprog_info[i].name;
> +
> + if (!name || !name[0])
> + name = "<unknown>";
> + verbose(env, "stack depth subprog %d %s %d\n", i, name,
> + env->subprog_info[i].stack_depth);
> + }
[Severity: Medium]
Will this break the veristat tool's ability to collect stack depth statistics?
Looking at parse_verif_log() in tools/testing/selftests/bpf/veristat.c, the
parser still expects the old single-line format:
if (2 == sscanf(cur, "stack depth %511s max %ld", stack, &s->stats[MAX_STACK]))
continue;
while ((token = strtok_r(cnt++ ? NULL : stack, "+", &state))) {
if (sscanf(token, "%d", &sub_stack) == 0)
break;
s->stats[STACK] += sub_stack;
}
With the new multi-line format emitted here, it appears this parsing logic
will silently fail to extract the stack depth numbers, leaving the STACK and
MAX_STACK metrics unpopulated when comparing regressions. Does veristat.c
need to be updated to match the new verifier output format?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260802225209.2511758-1-memxor@gmail.com?part=1
next prev parent reply other threads:[~2026-08-02 23:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-02 22:52 [PATCH bpf-next v2 0/3] Improve stack depth verification stats output Kumar Kartikeya Dwivedi
2026-08-02 22:52 ` [PATCH bpf-next v2 1/3] bpf: Show more useful info in stack depth stats Kumar Kartikeya Dwivedi
2026-08-02 23:04 ` sashiko-bot [this message]
2026-08-02 23:09 ` Kumar Kartikeya Dwivedi
2026-08-03 0:21 ` bot+bpf-ci
2026-08-03 0:40 ` Kumar Kartikeya Dwivedi
2026-08-02 22:52 ` [PATCH bpf-next v2 2/3] selftests/bpf: Adjust veristat stack depth parsing Kumar Kartikeya Dwivedi
2026-08-02 22:52 ` [PATCH bpf-next v2 3/3] selftests/bpf: Test stack depth stats without BTF subprog names Kumar Kartikeya Dwivedi
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=20260802230435.7F4331F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=memxor@gmail.com \
--cc=sashiko-reviews@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