All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>, bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next 20/21] selftests/bpf: Test programs above the old limits
Date: Mon, 16 Nov 2026 06:33:51 +0000	[thread overview]
Message-ID: <sashiko-outbox-216280@kernel.org> (raw)
In-Reply-To: <20261116055638.4171529-21-alexei.starovoitov@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] selftests/bpf: missing __load_if_JITed() on far_pad tests in
  verifier_unwind.c
- [Medium] selftests/bpf: live_recursion() fails on JIT archs without
  private stack
--

commit a69081d640b7a0d78afbe78ef6d18103940c7493
Author: Alexei Starovoitov <ast@kernel.org>

selftests/bpf: Test programs above the old limits

This commit adds BPF verifier selftests covering large map, subprogram,
and kptr counts, calls in dead code, dead bpf_loop() callbacks, and far
unwind cleanup pads.

> diff --git a/tools/testing/selftests/bpf/progs/verifier_no_limits.c b/tools/testing/selftests/bpf/progs/verifier_no_limits.c
> new file mode 100644
> index 0000000000000..b464ad3794a57
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/progs/verifier_no_limits.c
[ ... ]
> +void dead_recursion(void) SEC("?raw_tp") __success;
> +RECURSION(dead_recursion, 7)
> +
> +void live_recursion(void) SEC("?raw_tp") __failure __msg("in a tracing program");
> +RECURSION(live_recursion, 6)

[Severity: Medium]
Does live_recursion() fail log matching on JIT architectures without
private stack support (such as s390x, riscv64, and loongarch64)?

For non-kprobe programs like raw_tp, check_recursion() only emits
"recursive ... in a tracing program" when bpf_enable_priv_stack() is not
NO_PRIV_STACK:

kernel/bpf/verifier.c:check_recursion() {
    ...
			if ((bpf_enable_priv_stack(env->prog) != NO_PRIV_STACK ||
			     env->prog->type == BPF_PROG_TYPE_KPROBE) &&
			    !env->prog->aux->priv_stack_requested) {
				verbose(env, "recursive %s() in a tracing program\n",
					bpf_subprog_name(env, s));
				return -EINVAL;
			}
    ...
}

When bpf_jit_supports_private_stack() is false, bpf_enable_priv_stack()
returns NO_PRIV_STACK and check_recursion() instead logs "JIT does not
support recursive calls", so __msg("in a tracing program") does not match.

> diff --git a/tools/testing/selftests/bpf/progs/verifier_unwind.c b/tools/testing/selftests/bpf/progs/verifier_unwind.c
> index 5a21345c34d45..50ab11b909aed 100644
> --- a/tools/testing/selftests/bpf/progs/verifier_unwind.c
> +++ b/tools/testing/selftests/bpf/progs/verifier_unwind.c
> @@ -69,6 +69,36 @@ static unsigned long may_unwind(void)
>  	);
>  }
>  
> +/* The patches of the divisions push the pad out of the 16-bit range */
> +#define FAR_PAD(name, sub)					\
> +__naked void name(void)						\
> +{								\
> +	asm volatile (						\
> +		"r6 = *(u32 *)(r1 + 0);"			\
> +		"r1 = r6;"					\
> +		"r1 -= " #sub ";"				\
> +		"call may_unwind;"				\
> +		unwind_goto(8202)				\
> +		"r7 = 1;"					\
> +		".rept 8200; r7 /= r6; .endr;"			\
> +		"exit;"						\
> +		"r0 += 100;"					\
> +		"exit;"						\
> +		:						\
> +		: __imm_unwind_goto(8202)			\
> +		: __clobber_all);				\
> +}
> +
> +SEC("tc")
> +__arch_x86_64 __arch_arm64
> +__success __retval(7)
> +FAR_PAD(far_pad_returns, 64)
> +
> +SEC("tc")
> +__arch_x86_64 __arch_arm64
> +__success __retval(105)
> +FAR_PAD(far_pad_unwinds, 0)

[Severity: Medium]
Should far_pad_returns() and far_pad_unwinds() include __load_if_JITed()
like the other valid unwind subtests in verifier_unwind.c?

test_verifier_unwind() uses RUN(verifier_unwind) rather than RUN_JITED(),
while check_unwind_insns() sets prog->jit_required = 1.  When BPF JIT is
disabled, bpf_fixup_call_args() rejects both programs with -EINVAL and the
subtests fail instead of being skipped.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261116055638.4171529-1-alexei.starovoitov@gmail.com?part=20

  reply	other threads:[~2026-11-16  6:33 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16  5:56 [PATCH bpf-next 00/21] bpf: Remove the limits on maps, kfuncs, subprogs and special fields Alexei Starovoitov
2026-11-16  5:56 ` [PATCH bpf-next 01/21] bpf: Stop a load only when the loader is killed or has to freeze Alexei Starovoitov
2026-11-16  6:39   ` bot+bpf-ci
2026-11-16  6:49   ` sashiko-bot
2026-11-16  5:56 ` [PATCH bpf-next 02/21] bpf: Fail the load when there is no memory Alexei Starovoitov
2026-11-16  6:29   ` sashiko-bot
2026-11-16  5:56 ` [PATCH bpf-next 03/21] bpf: Give a syscall program the largest context when it does tail calls Alexei Starovoitov
2026-11-16  5:56 ` [PATCH bpf-next 04/21] bpf: Do not inline bpf_loop() when its callback is dead code Alexei Starovoitov
2026-11-16  5:56 ` [PATCH bpf-next 05/21] bpf: Dump programs that have more than 524288 insns Alexei Starovoitov
2026-11-16  5:56 ` [PATCH bpf-next 06/21] bpf: Resolve BTF structs and arrays first Alexei Starovoitov
2026-11-16  6:13   ` sashiko-bot
2026-11-16  5:56 ` [PATCH bpf-next 07/21] bpf: Remove the limits on maps, BTFs and fd_array of a program Alexei Starovoitov
2026-11-16  6:39   ` bot+bpf-ci
2026-11-16  5:56 ` [PATCH bpf-next 08/21] bpf: Do not scan all maps for each insn and each subprog Alexei Starovoitov
2026-11-16  6:16   ` sashiko-bot
2026-11-16  5:56 ` [PATCH bpf-next 09/21] bpf: Remove the limits on kfuncs of a program Alexei Starovoitov
2026-11-16  6:39   ` bot+bpf-ci
2026-11-16  5:56 ` [PATCH bpf-next 10/21] bpf: Remove the limits on tables of functions Alexei Starovoitov
2026-11-16  6:14   ` sashiko-bot
2026-11-16  5:56 ` [PATCH bpf-next 11/21] libbpf: Size the tables of the loader program from the object Alexei Starovoitov
2026-11-16  6:20   ` sashiko-bot
2026-11-16  5:56 ` [PATCH bpf-next 12/21] bpf: Relax jumps that patches push out of range Alexei Starovoitov
2026-11-16  6:52   ` bot+bpf-ci
2026-11-16  5:56 ` [PATCH bpf-next 13/21] bpf: Keep the call graph in lists of edges Alexei Starovoitov
2026-11-16  6:39   ` sashiko-bot
2026-11-16  5:56 ` [PATCH bpf-next 14/21] bpf: Find the effects of callees on the call graph Alexei Starovoitov
2026-11-16  5:56 ` [PATCH bpf-next 15/21] bpf: Link the decl tags of a type Alexei Starovoitov
2026-11-16  5:56 ` [PATCH bpf-next 16/21] bpf: Remove BPF_MAX_SUBPROGS Alexei Starovoitov
2026-11-16  5:56 ` [PATCH bpf-next 17/21] bpf: Walk each type once when looking for special fields Alexei Starovoitov
2026-11-16  5:56 ` [PATCH bpf-next 18/21] bpf: Raise the limit on the length of BTF names Alexei Starovoitov
2026-11-16  5:56 ` [PATCH bpf-next 19/21] bpf: Find dominators in O(n log n) Alexei Starovoitov
2026-11-16  5:56 ` [PATCH bpf-next 20/21] selftests/bpf: Test programs above the old limits Alexei Starovoitov
2026-11-16  6:33   ` sashiko-bot [this message]
2026-11-16  6:39   ` bot+bpf-ci
2026-11-16  5:56 ` [PATCH bpf-next 21/21] selftests/bpf: Test limits of the load with raw programs Alexei Starovoitov
2026-11-16  6:39   ` 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=sashiko-outbox-216280@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=alexei.starovoitov@gmail.com \
    --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 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.