selftests/bpf: Add tailcall epilogue test
authorMartin KaFai Lau <martin.lau@kernel.org>
Thu, 29 Aug 2024 21:08:29 +0000 (14:08 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 30 Aug 2024 01:15:45 +0000 (18:15 -0700)
commitb191b0fd740062ede672693671c6e6e942fb02f4
tree76d18a1e485b4eec73f07666f39c898cb970d336
parent47e69431b57aee6c3c134014e7fca490ca8ca9d1
selftests/bpf: Add tailcall epilogue test

This patch adds a gen_epilogue test to test a main prog
using a bpf_tail_call.

A non test_loader test is used. The tailcall target program,
"test_epilogue_subprog", needs to be used in a struct_ops map
before it can be loaded. Another struct_ops map is also needed
to host the actual "test_epilogue_tailcall" struct_ops program
that does the bpf_tail_call. The earlier test_loader patch
will attach all struct_ops maps but the bpf_testmod.c does
not support >1 attached struct_ops.

The earlier patch used the test_loader which has already covered
checking for the patched pro/epilogue instructions. This is done
by the __xlated tag.

This patch goes for the regular skel load and syscall test to do
the tailcall test that can also allow to directly pass the
the "struct st_ops_args *args" as ctx_in to the
SEC("syscall") program.

Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Link: https://lore.kernel.org/r/20240829210833.388152-8-martin.lau@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/prog_tests/pro_epilogue.c
tools/testing/selftests/bpf/progs/epilogue_tailcall.c [new file with mode: 0644]