]> www.infradead.org Git - users/willy/linux.git/commit
selftests/bpf: Add kfunc_call test for simple dtor in bpf_testmod
authorAlan Maguire <alan.maguire@oracle.com>
Thu, 20 Jun 2024 09:17:33 +0000 (10:17 +0100)
committerAndrii Nakryiko <andrii@kernel.org>
Fri, 21 Jun 2024 21:46:29 +0000 (14:46 -0700)
commit47a8cf0c5b3f6769b9d558301735c75119a0a165
tree4af832750443c5224152d4bdae82c8e69fc674c8
parent46fb0b62ea29c0dbcb3e44f1d67aafe79bc6e045
selftests/bpf: Add kfunc_call test for simple dtor in bpf_testmod

add simple kfuncs to create/destroy a context type to bpf_testmod,
register them and add a kfunc_call test to use them.  This provides
test coverage for registration of dtor kfuncs from modules.

By transferring the context pointer to a map value as a __kptr
we also trigger the map-based dtor cleanup logic, improving test
coverage.

Suggested-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20240620091733.1967885-7-alan.maguire@oracle.com
tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c
tools/testing/selftests/bpf/bpf_testmod/bpf_testmod_kfunc.h
tools/testing/selftests/bpf/prog_tests/kfunc_call.c
tools/testing/selftests/bpf/progs/kfunc_call_test.c