From: sashiko-bot@kernel.org
To: "Paul Chaignon" <paul.chaignon@gmail.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v2 1/3] bpf: Report maximum combined stack depth
Date: Thu, 14 May 2026 07:32:57 +0000 [thread overview]
Message-ID: <20260514073258.6501FC2BCC6@smtp.kernel.org> (raw)
In-Reply-To: <d3d23a0410f87f116f3bbaa98a815dbae113bda2.1778689025.git.paul.chaignon@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] On early verifier failure, 'max_stack_depth' logs as 0, which is inconsistent with the individual subprog stack depths shown.
--
commit 2f8f05d6e2f1d0777f2f9a6fc7f4f3d3c65baf3f
Author: Paul Chaignon <paul.chaignon@gmail.com>
bpf: Report maximum combined stack depth
This commit adds reporting for the maximum combined stack depth of BPF
programs to the verifier logs. It prints the max combined depth alongside
the per-subprog stack depths to provide a value closer to what is actually
enforced by the verifier.
> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> index 11054ad89c14d..39340a6780ebc 100644
> --- a/kernel/bpf/verifier.c
> +++ b/kernel/bpf/verifier.c
[ ... ]
> @@ -18289,7 +18293,7 @@ static void print_verification_stats(struct bpf_verifier_env *env)
> 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, "\n");
> + verbose(env, " max %d\n", env->max_stack_depth);
If the verifier fails early during do_check_main() or do_check_subprogs(),
the process skips check_max_stack_depth() and jumps directly to the
cleanup and logging phase.
Since env->max_stack_depth is only calculated in check_max_stack_depth(),
could this result in confusing log output on early failures where the
subprog depths are printed with a max depth of 0?
For example, it might output something like:
stack depth 16+256 max 0
Would it be better to conditionally print this value only if the max stack
depth check actually ran, or otherwise indicate that the check was
bypassed?
> verbose(env, "insns processed %d", env->subprog_info[0].insn_processed);
> for (i = 1; i < subprog_cnt; i++)
> if (bpf_subprog_is_global(env, i))
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1778689025.git.paul.chaignon@gmail.com?part=1
next prev parent reply other threads:[~2026-05-14 7:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-13 16:27 [PATCH bpf-next v2 0/3] bpf: Maximum combined stack depth Paul Chaignon
2026-05-13 16:28 ` [PATCH bpf-next v2 1/3] bpf: Report maximum " Paul Chaignon
2026-05-14 7:32 ` sashiko-bot [this message]
2026-05-13 16:29 ` [PATCH bpf-next v2 2/3] selftests/bpf: Test reported max " Paul Chaignon
2026-05-13 16:30 ` [PATCH bpf-next v2 3/3] veristat: Report " Paul Chaignon
2026-05-13 17:20 ` bot+bpf-ci
2026-05-14 10:06 ` sashiko-bot
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=20260514073258.6501FC2BCC6@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=paul.chaignon@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