Re: [PATCH bpf-next v4 12/13] selftests/bpf: Add tests for callbacks returning more than 8 bytes
Yonghong Song <[email protected]>
| Newsgroups | org.kernel.vger.bpf |
|---|---|
| Message-ID | <[email protected]> |
On 8/12/26 5:10 PM, Eduard Zingerman wrote: > On Mon, 2026-08-10 at 17:10 -0700, Yonghong Song wrote: >> Add two __failure tests covering the callback return-size checks: >> >> - timer_ret_pair_fail: a bpf_timer callback declared to return more than >> 8 bytes, rejected by check_ld_imm() where the callback's PTR_TO_FUNC is >> created, with "callback function with >8-byte return value is not >> supported". >> >> - exceptions_ret_pair_fail: an exception callback declared to return more >> than 8 bytes, rejected by do_check_common() when the callback >> subprogram is verified, with "exception cb cannot return value larger >> than 8 bytes". >> >> Both callback bodies are written in inline asm so that the tests do not >> depend on LLVM 23 R0:R2 codegen and run on any compiler. The verifier reads >> the return type from BTF rather than from the instructions, so the >8 byte >> return prototype is supplied through __btf_func_path(), pointing at a >> companion btf__*.c program that exists only to carry that BTF. >> >> Signed-off-by: Yonghong Song <[email protected]> >> --- >> .../selftests/bpf/prog_tests/exceptions.c | 2 + >> .../testing/selftests/bpf/prog_tests/timer.c | 2 + >> .../bpf/progs/btf__exceptions_ret_pair_fail.c | 10 ++++ >> .../bpf/progs/btf__timer_ret_pair_fail.c | 10 ++++ >> .../bpf/progs/exceptions_ret_pair_fail.c | 30 ++++++++++++ >> .../selftests/bpf/progs/timer_ret_pair_fail.c | 49 +++++++++++++++++++ >> 6 files changed, 103 insertions(+) > Dropping callback checks avoids adding all this code. Yes, I removed 'bpf: Reject callbacks returning more than 8 bytes' so this patch will be removed as well. > > ...