From: sashiko-bot@kernel.org
To: "Yonghong Song" <yonghong.song@linux.dev>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v2 1/2] selftests/bpf: Keep int return type for tailcall subprogs
Date: Tue, 09 Jun 2026 23:42:51 +0000 [thread overview]
Message-ID: <20260609234251.C1A6F1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260609233407.2711577-1-yonghong.song@linux.dev>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Incomplete application of compiler optimization mitigation in `classifier_0`.
--
commit 230de7228ec64290b0e30a90f68ca96dd2ee6dd0
Author: Yonghong Song <yonghong.song@linux.dev>
selftests/bpf: Keep int return type for tailcall subprogs
This commit updates tailcall subprograms to prevent LLVM 23 from optimizing
their return types from 'int' to 'void', which would cause verifier failures.
It uses barrier_var() and __sink() to ensure the compiler retains the int
return type.
> diff --git a/tools/testing/selftests/bpf/progs/tailcall_bpf2bpf_hierarchy2.c b/tools/testing/selftests/bpf/progs/tailcall_bpf2bpf_hierarchy2.c
> index ae94c9c70ab7d..6fde0ab921486 100644
> --- a/tools/testing/selftests/bpf/progs/tailcall_bpf2bpf_hierarchy2.c
> +++ b/tools/testing/selftests/bpf/progs/tailcall_bpf2bpf_hierarchy2.c
[ ... ]
> @@ -41,16 +44,22 @@ int classifier_0(struct __sk_buff *skb)
> static __noinline
> int subprog_tail1(struct __sk_buff *skb)
> {
> + int ret = 0;
> +
> bpf_tail_call_static(skb, &jmp_table, 1);
> - return 0;
> + barrier_var(ret);
> + return ret;
> }
>
> __auxiliary
> SEC("tc")
> int classifier_1(struct __sk_buff *skb)
> {
> + int ret;
> +
> count1++;
> - subprog_tail1(skb);
> + ret = subprog_tail1(skb);
> + __sink(ret);
> return 0;
> }
[Severity: Medium]
In classifier_1() here, the return value of subprog_tail1() is captured and
sunk using __sink() to prevent optimization. Should classifier_0() also be
updated symmetrically to capture and sink the return value of subprog_tail0()?
Looking at classifier_0() in the same file:
__auxiliary
SEC("tc")
int classifier_0(struct __sk_buff *skb)
{
count0++;
subprog_tail0(skb);
return 0;
}
While the return value of subprog_tail0() is currently sunk elsewhere in
tailcall_bpf2bpf_hierarchy_2(), leaving this callsite unsunk could
potentially leave the code fragile to LLVM optimizations that might create a
void-returning clone of subprog_tail0() specifically for classifier_0().
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260609233402.2711071-1-yonghong.song@linux.dev?part=1
next prev parent reply other threads:[~2026-06-09 23:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-09 23:34 [PATCH bpf-next v2 0/2] selftests/bpf: Fix tests for llvm23 true signature Yonghong Song
2026-06-09 23:34 ` [PATCH bpf-next v2 1/2] selftests/bpf: Keep int return type for tailcall subprogs Yonghong Song
2026-06-09 23:42 ` sashiko-bot [this message]
2026-06-10 3:41 ` Yonghong Song
2026-06-10 4:06 ` Yonghong Song
2026-06-10 0:07 ` bot+bpf-ci
2026-06-10 3:45 ` Yonghong Song
2026-06-09 23:34 ` [PATCH bpf-next v2 2/2] selftests/bpf: Adjust fexit_bpf2bpf ctx layout for llvm23 true signature Yonghong Song
2026-06-10 4:30 ` [PATCH bpf-next v2 0/2] selftests/bpf: Fix tests " patchwork-bot+netdevbpf
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=20260609234251.C1A6F1F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox