From: sashiko-bot@kernel.org
To: "Arnd Bergmann" <arnd@kernel.org>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH] bpf: reduce kernel stack usage in bpf_guess_first_trips()
Date: Tue, 24 Nov 2026 14:09:36 +0000 [thread overview]
Message-ID: <sashiko-outbox-231307@kernel.org> (raw)
In-Reply-To: <20261124140155.1555535-1-arnd@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] bpf: missing BPF_VERIFIER_GFP in bpf_guess_first_trips()
allocation
--
commit 166dd425d776a0ec6b6a3e502aed3e0810e29438
Author: Arnd Bergmann <arnd@arndb.de>
bpf: reduce kernel stack usage in bpf_guess_first_trips()
This commit moves the temporary bpf_verifier_state in
bpf_guess_first_trips() from the stack to the heap to reduce stack frame
size.
> diff --git a/kernel/bpf/equation_join.c b/kernel/bpf/equation_join.c
> index d7ad7fb52ed6c..4123a84482372 100644
> --- a/kernel/bpf/equation_join.c
> +++ b/kernel/bpf/equation_join.c
> @@ -1455,7 +1455,7 @@ int bpf_guess_first_trips(struct bpf_verifier_env *env, struct bpf_verifier_stat
> struct bpf_loop *loop)
> {
> struct loop_stack_entry *e = bpf_top_loop(st->frame[st->curframe]);
> - struct bpf_verifier_state next = {};
> + struct bpf_verifier_state *next;
> struct bpf_loop_steps *steps;
> u64 trips = U64_MAX, xreg;
> struct scalar *s;
> @@ -1488,15 +1488,18 @@ int bpf_guess_first_trips(struct bpf_verifier_env *env, struct bpf_verifier_stat
> return 0;
> e->exit_threshold = e->trip_index.r64.base + trips;
> add_iv_threshold(env, loop, e->exit_threshold, 1, THRESHOLD_EXIT_JUMP, U32_MAX);
> + next = kzalloc_obj(*next);
> + if (!next)
> + return -ENOMEM;
[Severity: Low]
Should kzalloc_obj() pass BPF_VERIFIER_GFP here, like the other verifier
allocations in find_steps() and bpf_copy_verifier_state()?
Without BPF_VERIFIER_GFP (GFP_KERNEL_ACCOUNT | __GFP_RETRY_MAYFAIL |
__GFP_NOWARN), this allocation is not charged to the caller's memcg and can
emit page allocation warnings or invoke the OOM killer under memory
pressure instead of failing the program load cleanly.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261124140155.1555535-1-arnd@kernel.org?part=1
prev parent reply other threads:[~2026-11-24 14:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 14:01 [PATCH] bpf: reduce kernel stack usage in bpf_guess_first_trips() Arnd Bergmann
2026-11-24 14:09 ` sashiko-bot [this message]
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=sashiko-outbox-231307@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=arnd@kernel.org \
--cc=bpf@vger.kernel.org \
--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