]> git.ipfire.org Git - thirdparty/linux.git/commit
selftests/bpf: Add tests for ctx fixed offset support
authorKumar Kartikeya Dwivedi <memxor@gmail.com>
Fri, 27 Feb 2026 00:57:25 +0000 (16:57 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 3 Mar 2026 16:45:16 +0000 (08:45 -0800)
commitf6312e71759ddb10b20fbdb9ee01b9546cabd4e3
tree817e2fd77f8ec8431d18bea57b8ac8cdf76e6f32
parentde6c7d99f898d82106e3c3b84cd03453201a565c
selftests/bpf: Add tests for ctx fixed offset support

Add tests to ensure PTR_TO_CTX supports fixed offsets for program types
that don't rewrite accesses to it. Ensure that variable offsets and
negative offsets are still rejected. An extra test also checks writing
into ctx with modified offset for syscall progs. Other program types do
not support writes (notably, writable tracepoints offer a pointer for a
writable buffer through ctx, but don't allow writing to the ctx itself).

Before the fix made in the previous commit, these tests do not succeed,
except the ones testing for failures regardless of the change.

Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
Link: https://lore.kernel.org/r/20260227005725.1247305-3-memxor@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/progs/verifier_ctx.c