summaryrefslogtreecommitdiff
path: root/rust/kernel/alloc/kvec/errors.rs
diff options
context:
space:
mode:
authorKumar Kartikeya Dwivedi <memxor@gmail.com>2026-10-19 15:21:51 +0200
committerAlexei Starovoitov <ast@kernel.org>2026-10-19 19:45:03 +0000
commit1dad22de9c035afbe93b9c8f5eab24d25aaf6bb8 (patch)
tree4dc87a865b456e2ea5629305b3f9d6b5be9cbc48 /rust/kernel/alloc/kvec/errors.rs
parent9278bedb22deb16f5c7084be5a7791f62520b939 (diff)
selftests/bpf: Test __arena pointer members
Add a struct_ops member to bpf_testmod whose argument struct publishes arena pointers: a plain one, a __nullable one that is left NULL, one behind a nested struct, one inside a union, next to a scalar, together with a kfunc that fills the struct with the kernel address of an __arena argument and calls the member. Two callbacks read the pointers back. One shares the header with the module, so the members are arena pointers on the program side as well and need no cast; it also records the register a load produces, which must be the arena offset with the upper 32 bits clear, reads the member with a load-acquire as well, which has to yield the same pointer, and hands the pointer to an __arena kfunc. The other mirrors the vmlinux.h rendering of the struct, a kernel pointer with the type tag as an attribute, and casts the members to the arena address space the way a program built against vmlinux.h has to. Both increment the value through each pointer and the trigger checks the count. The first callback also reads a member through a plain pointer to a bad address, a probed load that is skipped or faults, and checks that it reads as NULL rather than as an arena pointer. The failure cases cover a store to the member, which a struct_ops program cannot do to any argument member, a load from the union, an exchange, one insn loading the arena pointer on one path and a scalar or a memory pointer on another, and a program without an arena. On a kernel whose module BTF carries no type tags the member tests are reported as skipped. Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://patch.msgid.link/20261019132203.3034698-10-memxor@gmail.com
Diffstat (limited to 'rust/kernel/alloc/kvec/errors.rs')
0 files changed, 0 insertions, 0 deletions