Re: [PATCH bpf-next v6 09/10] selftests/bpf: Add inline-asm and subprog tests for R0:R2 returns
Yonghong Song <[email protected]>
| Newsgroups | dev.linux.lists.sashiko-reviews,org.kernel.vger.bpf |
|---|---|
| Message-ID | <[email protected]> |
On 8/16/26 9:42 PM, [email protected] wrote: > Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: > - [Medium] The test `aggregate_ret_kfunc_too_big_fail` is incorrectly restricted to only run on x86_64 and arm64 architectures. > -- > > --- Patch [9]: [PATCH bpf-next v6 09/10] selftests/bpf: Add inline-asm and subprog tests for R0:R2 returns --- > commit b44fbeb59afa99f6be0f33037220d124e0fb4e12 > Author: Yonghong Song <[email protected]> > > selftests/bpf: Add inline-asm and subprog tests for R0:R2 returns > > This commit adds BPF inline-assembly tests to cover BPF-to-BPF returns, kfunc > calls, backtracking, and liveness for functions returning values in the R0:R2 > register pair. It also includes an extension test to ensure a function returning > R0:R2 cannot be replaced. > >> diff --git a/tools/testing/selftests/bpf/progs/aggregate_ret_kfunc.c b/tools/testing/selftests/bpf/progs/aggregate_ret_kfunc.c >> new file mode 100644 >> index 0000000000000..c23b4beb1773c >> --- /dev/null >> +++ b/tools/testing/selftests/bpf/progs/aggregate_ret_kfunc.c > [ ... ] > >> +/* >> + * A return value larger than 16 bytes does not fit in R0:R2 and is rejected by >> + * btf_distill_func_proto(), before the KF_FASTCALL and JIT-capability checks, >> + * so this behaves the same on every architecture. >> + */ >> +SEC("tc") >> +__arch_x86_64 __arch_arm64 > [Severity: Medium] > Are these architecture restriction tags intended here? > > The comment right above mentions that this test behaves the same on every > architecture, but the __arch_x86_64 and __arch_arm64 tags artificially limit > aggregate_ret_kfunc_too_big_fail() to only run on those two architectures, > which prevents the test from running on others. Okay, I don't have 100% confidence about every architecture. So let us change to /* * A return value larger than 16 bytes does not fit in R0:R2 and is rejected by * btf_distill_func_proto() before the KF_FASTCALL and JIT-capability checks. */ > >> +__failure __msg("The function bpf_kfunc_call_test_ret_big return type STRUCT is unsupported") >> +__naked int aggregate_ret_kfunc_too_big_fail(void) >> +{ >> + asm volatile ( >> + "call %[bpf_kfunc_call_test_ret_big];" >> + "r0 = 0;" >> + "exit;" >> + : >> + : __imm(bpf_kfunc_call_test_ret_big) >> + : __clobber_all); >> +}