From: Yonghong Song <yonghong.song@linux.dev>
To: sashiko-reviews@lists.linux.dev
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v3 10/13] selftests/bpf: Add C tests for 16-byte returns in R0:R2
Date: Mon, 10 Aug 2026 09:51:27 -0700 [thread overview]
Message-ID: <a3f40063-9142-4bb3-afc4-046b73f462ef@linux.dev> (raw)
In-Reply-To: <20260808192726.EBB0E1F000E9@smtp.kernel.org>
On 8/8/26 12:27 PM, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] The `aggregate_ret_kfunc_c` test will fail to load instead of gracefully skipping on 32-bit kernels when compiled with LLVM >= 23, due to a mismatch in `__SIZEOF_INT128__` definitions causing a ksym resolution failure.
> --
>
> --- Patch [10]: [PATCH bpf-next v3 10/13] selftests/bpf: Add C tests for 16-byte returns in R0:R2 ---
> commit 34be80f3aa8159c8e9fb57e485947ec4dc335cca
> Author: Yonghong Song <yonghong.song@linux.dev>
>
> selftests/bpf: Add C tests for 16-byte returns in R0:R2
>
> This commit adds selftests that exercise a 16-byte return value passed in the
> R0:R2 register pair. It covers __int128, 16-byte struct, and 16-byte union
> returns. It also adds tests for __int128 and 16-byte struct returns from a
> kfunc, with bpf_kfunc_call_test_i128() guarded by __SIZEOF_INT128__.
>
>> diff --git a/tools/testing/selftests/bpf/prog_tests/aggregate_ret.c b/tools/testing/selftests/bpf/prog_tests/aggregate_ret.c
>> new file mode 100644
>> index 0000000000000..e4317399d711b
>> --- /dev/null
>> +++ b/tools/testing/selftests/bpf/prog_tests/aggregate_ret.c
> [ ... ]
>
>> +static void test_kfunc_c(void)
>> +{
>> + struct aggregate_ret_kfunc_c *skel;
>> + bool supported;
>> + int err;
>> +
>> + skel = aggregate_ret_kfunc_c__open();
>> + if (!ASSERT_OK_PTR(skel, "skel_kfunc_c_open"))
>> + return;
>> +
>> + supported = skel->rodata->has_reg_pair_ret;
>> +
>> + /*
>> + * Where the JIT cannot hand the second half of a >8-byte kfunc return
>> + * back in R0:R2, bpf_add_kfunc_call() rejects the call with
>> + * -EOPNOTSUPP. Asking the kernel keeps this test free of a list of the
>> + * JITs that can, which would have to be updated as the rest of them
>> + * learn.
>> + */
>> + err = aggregate_ret_kfunc_c__load(skel);
>> + if (err == -EOPNOTSUPP)
>> + supported = false;
>> + else if (!ASSERT_OK(err, "skel_kfunc_c_load"))
>> + goto out;
> [Severity: Medium]
> Will this load fail with an assertion error instead of gracefully skipping on
> 32-bit kernels when compiled with LLVM >= 23?
>
> If the host kernel is 32-bit, bpf_testmod is built without __SIZEOF_INT128__,
> omitting bpf_kfunc_call_test_i128 from the module BTF.
>
> However, because the BPF program aggregate_ret_kfunc_c.c is compiled for a
> 64-bit BPF target, __SIZEOF_INT128__ will be defined, and it will
> unconditionally reference the bpf_kfunc_call_test_i128 kfunc via the
> bpf_testmod_kfunc.h header.
>
> During aggregate_ret_kfunc_c__load(), libbpf will attempt to resolve the
> kfunc, but since it is missing from the 32-bit kernel's BTF, it will fail and
> return a relocation error (such as -ENOENT) rather than -EOPNOTSUPP. This
> would cause the ASSERT_OK(err) check to fail.
To avoid complexity, the current implementation should be okay. The CI tests
only for 64bit arch (x86_64, arm64 and s390x). Running selftests with 32bit arch
may fail (or fail with other tests too).
next prev parent reply other threads:[~2026-08-10 16:51 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-08 19:03 [PATCH bpf-next v3 00/13] bpf: Support aggregate return values up to 16 bytes Yonghong Song
2026-08-08 19:03 ` [PATCH bpf-next v3 01/13] bpf: Factor check_global_ret_scalar_reg() out of the global return check Yonghong Song
2026-08-08 19:03 ` [PATCH bpf-next v3 02/13] bpf: Add helpers to describe the R0:R2 return register pair Yonghong Song
2026-08-08 19:03 ` [PATCH bpf-next v3 03/13] bpf: Wire up JIT support for 16-byte kfunc returns Yonghong Song
2026-08-08 19:39 ` sashiko-bot
2026-08-10 16:29 ` Yonghong Song
2026-08-08 19:03 ` [PATCH bpf-next v3 04/13] bpf: Track R2 of register-pair returns in precision backtracking Yonghong Song
2026-08-08 19:29 ` sashiko-bot
2026-08-10 16:30 ` Yonghong Song
2026-08-08 19:03 ` [PATCH bpf-next v3 05/13] bpf: Account R2 of register-pair returns in live register analysis Yonghong Song
2026-08-08 19:03 ` [PATCH bpf-next v3 06/13] bpf: Reject callbacks returning more than 8 bytes Yonghong Song
2026-08-08 19:45 ` sashiko-bot
2026-08-10 16:36 ` Yonghong Song
2026-08-08 19:03 ` [PATCH bpf-next v3 07/13] bpf: Add verifier support for 16-byte returns in R0:R2 Yonghong Song
2026-08-08 19:41 ` sashiko-bot
2026-08-10 16:44 ` Yonghong Song
2026-08-08 19:04 ` [PATCH bpf-next v3 08/13] bpf: Reject register-pair returns when the subprog BTF is unreliable Yonghong Song
2026-08-08 19:04 ` [PATCH bpf-next v3 09/13] bpf: Enable aggregate return types up to 16 bytes Yonghong Song
2026-08-08 19:04 ` [PATCH bpf-next v3 10/13] selftests/bpf: Add C tests for 16-byte returns in R0:R2 Yonghong Song
2026-08-08 19:27 ` sashiko-bot
2026-08-10 16:51 ` Yonghong Song [this message]
2026-08-08 19:04 ` [PATCH bpf-next v3 11/13] selftests/bpf: Add inline-asm and subprog tests for R0:R2 returns Yonghong Song
2026-08-08 19:04 ` [PATCH bpf-next v3 12/13] selftests/bpf: Add tests for callbacks returning more than 8 bytes Yonghong Song
2026-08-08 19:04 ` [PATCH bpf-next v3 13/13] Documentation/bpf: Document up to 16-byte kfunc return values in R0:R2 Yonghong Song
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=a3f40063-9142-4bb3-afc4-046b73f462ef@linux.dev \
--to=yonghong.song@linux.dev \
--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