BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Kumar Kartikeya Dwivedi" <memxor@gmail.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v1 1/3] bpf: Show more useful info in stack depth stats
Date: Sat, 01 Aug 2026 23:11:13 +0000	[thread overview]
Message-ID: <20260801231113.D0B711F00AC4@smtp.kernel.org> (raw)
In-Reply-To: <20260801230400.850271-2-memxor@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The new stack depth verifier log format breaks stack metrics parsing in the `veristat` tool.
--

--- Patch [1]: [PATCH bpf-next v1 1/3] bpf: Show more useful info in stack depth stats ---
commit f7cb915ff02de7a02fe7b2353a1f2d77e1852496
Author: Kumar Kartikeya Dwivedi <memxor@gmail.com>

bpf: Show more useful info in stack depth stats

This commit changes the output format of stack depth statistics in the BPF
verifier log. It replaces the old subprogram index-based format with a clearer
name and depth format, avoiding hard-to-read sequences.

> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> index 8d0635ee48c7e..51ac0a9ae3394 100644
> --- a/kernel/bpf/verifier.c
> +++ b/kernel/bpf/verifier.c
> @@ -18703,10 +18703,18 @@ 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");
> +		for (i = 0; i < subprog_cnt; i++) {
> +			const char *name = env->subprog_info[i].name;
> +
> +			if (name && name[0])
> +				verbose(env, " %s=%d", name,
> +					env->subprog_info[i].stack_depth);
> +			else
> +				verbose(env, " subprog[%d]=%d", i,
> +					env->subprog_info[i].stack_depth);
> +		}
> +		verbose(env, " max=%d\n", env->max_stack_depth);

[Severity: Medium]
Does this change break the veristat tool's parsing of stack depths?

Looking at tools/testing/selftests/bpf/veristat.c in parse_verif_log(), it
appears to rely on the old format using a hardcoded string and splitting by
the plus sign:

tools/testing/selftests/bpf/veristat.c:parse_verif_log() {
    ...
    if (2 == sscanf(cur, "stack depth %511s max %ld", stack, &s->stats[MAX_STACK]))
    ...
    while ((token = strtok_r(cnt++ ? NULL : stack, "+", &state))) {
        if (sscanf(token, "%d", &sub_stack) == 0)
            break;
    ...
}

Since the verifier now outputs max=%ld instead of max %ld, and the individual
depths are formatted as name=depth rather than numbers separated by a plus
sign, will veristat silently fail to parse STACK and MAX_STACK metrics when
processing BPF objects?

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260801230400.850271-1-memxor@gmail.com?part=1

  reply	other threads:[~2026-08-01 23:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-01 23:03 [PATCH bpf-next v1 0/3] Improve stack depth verification stats output Kumar Kartikeya Dwivedi
2026-08-01 23:03 ` [PATCH bpf-next v1 1/3] bpf: Show more useful info in stack depth stats Kumar Kartikeya Dwivedi
2026-08-01 23:11   ` sashiko-bot [this message]
2026-08-01 23:15     ` Kumar Kartikeya Dwivedi
2026-08-02  0:35   ` bot+bpf-ci
2026-08-01 23:03 ` [PATCH bpf-next v1 2/3] selftests/bpf: Adjust veristat stack depth parsing Kumar Kartikeya Dwivedi
2026-08-01 23:03 ` [PATCH bpf-next v1 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=20260801231113.D0B711F00AC4@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