From: "Kumar Kartikeya Dwivedi" <memxor@gmail.com>
To: <bot+bpf-ci@kernel.org>, <bpf@vger.kernel.org>
Cc: <ast@kernel.org>, <andrii@kernel.org>, <daniel@iogearbox.net>,
<eddyz87@gmail.com>, <emil@etsalapatis.com>, <tj@kernel.org>,
<kkd@meta.com>, <kernel-team@meta.com>, <martin.lau@kernel.org>,
<yonghong.song@linux.dev>, <mason@kernel.org>,
<ihor.solodrai@linux.dev>
Subject: Re: [PATCH bpf-next v2 18/18] selftests/bpf: Test the 2 KiB stack budget
Date: Thu, 24 Sep 2026 11:58:01 +0200 [thread overview]
Message-ID: <DLNGHPJYHLOH.1KYZYC4XQPTRM@gmail.com> (raw)
In-Reply-To: <a0d61b61004d7351500248ef2a9e84ad6634dea366fe9bb15cd0a0887b301a82@mail.kernel.org>
On Thu Sep 24, 2026 at 11:13 AM CEST, bot+bpf-ci wrote:
>> diff --git a/tools/testing/selftests/bpf/progs/verifier_large_stack.c b/tools/testing/selftests/bpf/progs/verifier_large_stack.c
>> new file mode 100644
>> index 000000000000..2d4c81a3f0cb
>> --- /dev/null
>> +++ b/tools/testing/selftests/bpf/progs/verifier_large_stack.c
>> @@ -0,0 +1,377 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +
>> +#include <linux/bpf.h>
>> +#include <bpf/bpf_helpers.h>
>> +#include "bpf_misc.h"
>> +
>> +/*
>> + * Programs may use MAX_BPF_STACK_JIT (2 KiB) of stack on JITs that support
>> + * large stacks, combined over a call chain, with no separate limit on a
>> + * single frame. Interpreted programs and other JITs keep 512 bytes.
>> + */
>> +
>> +SEC("socket")
>> +__description("single frame of 2048 bytes")
>> +__load_if_large_stack()
>> +__success __success_unpriv __retval(42)
>> +__naked void single_frame_2048(void)
>> +{
>> + asm volatile (" \
>> + r1 = r10; \
>> + r1 += -2048; \
>> + r0 = 42; \
>> + *(u64*)(r1 + 0) = r0; \
>> + r0 = *(u64*)(r1 + 0); \
>> + exit; \
>> +" ::: __clobber_all);
>> +}
>> +
>> +SEC("socket")
>> +__description("single frame of 2048 bytes without large stack support")
>> +__load_if_no_large_stack()
>> +__failure __msg("invalid write to stack R1 off=-2048 size=8")
>> +__naked void single_frame_2048_no_large_stack(void)
>> +{
>> + asm volatile (" \
>> + r0 = 0; \
>> + exit; \
>> +" ::: __clobber_all);
>> +}
>
> Does the single_frame_2048_no_large_stack test body match its expected
> failure message?
>
> This test is meant to verify that a 2 KiB frame is rejected on systems
> without large stack support (the interpreter, bpf_jit_enable=0, and JITs
> without bpf_jit_supports_large_stack() like s390x, riscv64, loongarch,
> and powerpc).
>
> The test is marked __failure with the expected message "invalid write to
> stack R1 off=-2048 size=8", but the test body is:
>
> r0 = 0;
> exit;
>
> This 2-instruction program never touches fp-2048, so it verifies fine on
> all configurations. The __failure annotation then causes
> ASSERT_ERR(err, "unexpected_load_success") to trip in run_subtest() in
> test_loader.c, failing the test on every configuration it targets.
>
> Looking at single_frame_2048 above, the expected error message matches
> this sequence:
>
> r1 = r10;
> r1 += -2048;
> r0 = 42;
> *(u64*)(r1 + 0) = r0;
>
> Should single_frame_2048_no_large_stack repeat that write sequence so the
> verifier rejects it with the expected message on systems without large
> stack support?
>
Not a bug: single_frame_2048_no_large_stack does store through r1 = r10 - 2048;
the quoted two-instruction body is not in the patch.
>
> ---
> AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
> See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
>
> CI run summary: https://github.com/kernel-patches/bpf/actions/runs/35976322553
prev parent reply other threads:[~2026-09-24 9:58 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-24 8:25 [PATCH bpf-next v2 00/18] Raise BPF program stack size to 2KiB Kumar Kartikeya Dwivedi
2026-09-24 8:25 ` [PATCH bpf-next v2 01/18] bpf: Add accessors for verifier stack slots Kumar Kartikeya Dwivedi
2026-09-24 8:25 ` [PATCH bpf-next v2 02/18] bpf: Widen the stack slot index in the jump history Kumar Kartikeya Dwivedi
2026-09-24 8:25 ` [PATCH bpf-next v2 03/18] bpf: Store linked registers in the jump history as an array Kumar Kartikeya Dwivedi
2026-09-24 8:25 ` [PATCH bpf-next v2 04/18] bpf: Track backtracking stack slots with bitmaps Kumar Kartikeya Dwivedi
2026-09-24 8:25 ` [PATCH bpf-next v2 05/18] bpf: Track scratched stack slots with a bitmap Kumar Kartikeya Dwivedi
2026-09-24 8:25 ` [PATCH bpf-next v2 06/18] bpf: Treat unknown-size stack reads as reaching the frame top Kumar Kartikeya Dwivedi
2026-09-24 8:25 ` [PATCH bpf-next v2 07/18] bpf: Size liveness stack masks by the stack each frame uses Kumar Kartikeya Dwivedi
2026-09-24 15:12 ` Alexei Starovoitov
2026-09-24 8:25 ` [PATCH bpf-next v2 08/18] bpf: Grow the verifier id scratch on demand Kumar Kartikeya Dwivedi
2026-09-24 9:13 ` bot+bpf-ci
2026-09-24 9:55 ` Kumar Kartikeya Dwivedi
2026-09-24 8:25 ` [PATCH bpf-next v2 09/18] selftests/bpf: Cover the tail call caller stack depth limit Kumar Kartikeya Dwivedi
2026-09-24 8:25 ` [PATCH bpf-next v2 10/18] selftests/bpf: Check that narrow stack stores define no slot Kumar Kartikeya Dwivedi
2026-09-24 8:25 ` [PATCH bpf-next v2 11/18] selftests/bpf: Check liveness merge of masks with different widths Kumar Kartikeya Dwivedi
2026-09-24 8:25 ` [PATCH bpf-next v2 12/18] bpf: Size the per-frame verifier structures for a 2 KiB stack Kumar Kartikeya Dwivedi
2026-09-24 9:13 ` bot+bpf-ci
2026-09-24 9:56 ` Kumar Kartikeya Dwivedi
2026-09-24 8:25 ` [PATCH bpf-next v2 13/18] bpf: Bound program stack use by a per-program limit Kumar Kartikeya Dwivedi
2026-09-24 9:13 ` bot+bpf-ci
2026-09-24 9:56 ` Kumar Kartikeya Dwivedi
2026-09-24 8:25 ` [PATCH bpf-next v2 14/18] selftests/bpf: Add load conditions on the program stack limit Kumar Kartikeya Dwivedi
2026-09-24 8:25 ` [PATCH bpf-next v2 15/18] selftests/bpf: Give the 512-byte stack boundary tests a 2 KiB twin Kumar Kartikeya Dwivedi
2026-09-24 9:13 ` bot+bpf-ci
2026-09-24 9:56 ` Kumar Kartikeya Dwivedi
2026-09-24 8:25 ` [PATCH bpf-next v2 16/18] bpf, x86: Allow programs 2 KiB of stack Kumar Kartikeya Dwivedi
2026-09-24 9:13 ` bot+bpf-ci
2026-09-24 9:57 ` Kumar Kartikeya Dwivedi
2026-09-24 8:25 ` [PATCH bpf-next v2 17/18] bpf, arm64: " Kumar Kartikeya Dwivedi
2026-09-24 9:00 ` bot+bpf-ci
2026-09-24 9:57 ` Kumar Kartikeya Dwivedi
2026-09-24 8:25 ` [PATCH bpf-next v2 18/18] selftests/bpf: Test the 2 KiB stack budget Kumar Kartikeya Dwivedi
2026-09-24 9:13 ` bot+bpf-ci
2026-09-24 9:58 ` Kumar Kartikeya Dwivedi [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=DLNGHPJYHLOH.1KYZYC4XQPTRM@gmail.com \
--to=memxor@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bot+bpf-ci@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=ihor.solodrai@linux.dev \
--cc=kernel-team@meta.com \
--cc=kkd@meta.com \
--cc=martin.lau@kernel.org \
--cc=mason@kernel.org \
--cc=tj@kernel.org \
--cc=yonghong.song@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.