]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
selftests/bpf: Add syscall ctx variable offset tests
authorKumar Kartikeya Dwivedi <memxor@gmail.com>
Mon, 6 Apr 2026 19:43:58 +0000 (21:43 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 6 Apr 2026 22:27:26 +0000 (15:27 -0700)
commit5a34139b273272af2badcb695931493ed400befc
treefff764672502d29a7dd4ded9c2f95f2e4f6d7d8e
parent02f500ce0109ec553864507da685bd5fbc906e94
selftests/bpf: Add syscall ctx variable offset tests

Add various tests to exercise fixed and variable offsets on PTR_TO_CTX
for syscall programs, and cover disallowed cases for other program types
lacking convert_ctx_access callback. Load verifier_ctx with CAP_SYS_ADMIN
so that kfunc related logic can be tested. While at it, convert assembly
tests to C. Unfortunately, ctx_pointer_to_helper_2's unpriv case conflicts
with usage of kfuncs in the file and cannot be run.

Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
Acked-by: Puranjay Mohan <puranjay@kernel.org>
Acked-by: Mykyta Yatsenko <yatsenko@meta.com>
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/r/20260406194403.1649608-5-memxor@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/progs/verifier_ctx.c
tools/testing/selftests/bpf/test_kmods/bpf_testmod.c