linux/tools/testing/selftests/bpf/test_kmods
Puranjay Mohan 197d34b169
selftests/bpf: Test a multi-slot argument before a struct_ops arena argument
The trampoline reads the __arena flag from the btf_func_model per
argument but stores the ctx one register slot at a time, so the two only
line up if every preceding argument occupies exactly one slot. Every
arena-bearing member of bpf_testmod_ops3 takes single-slot arguments, so
nothing exercises the mapping and a mis-indexed arg_flags lookup would
go unnoticed on any architecture.

Add test_arena_multislot(), whose first argument is a 16-byte struct
passed by value. It fills ctx[0] and ctx[1], putting the arena pointer
at argument index one but slot two. The callback checks both halves of
the struct before dereferencing ctx[2], so a JIT that walks registers
instead of arguments converts the wrong slot and fails the test.

Signed-off-by: Puranjay Mohan <puranjay@kernel.org>
Acked-by: Xu Kuohai <xukuohai@huawei.com>
Link: https://lore.kernel.org/bpf/20260813190356.335181-8-puranjay@kernel.org
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
2026-08-14 05:55:03 +02:00
..
.gitignore
bpf_test_modorder_x.c
bpf_test_modorder_y.c
bpf_test_no_cfi.c
bpf_test_rqspinlock.c selftests/bpf: Add success stats to rqspinlock stress test 2025-11-29 09:35:36 -08:00
bpf_testmod_kfunc.h selftests/bpf: Test a multi-slot argument before a struct_ops arena argument 2026-08-14 05:55:03 +02:00
bpf_testmod-events.h selftests/bpf: test bpf_get_func_arg() for tp_btf 2026-01-21 09:31:35 -08:00
bpf_testmod.c selftests/bpf: Test a multi-slot argument before a struct_ops arena argument 2026-08-14 05:55:03 +02:00
bpf_testmod.h selftests/bpf: Test a multi-slot argument before a struct_ops arena argument 2026-08-14 05:55:03 +02:00
Makefile selftests/bpf: Fix test_kmods KDIR to honor O= and distro kernels 2026-06-05 14:20:57 -07:00