]> www.infradead.org Git - users/jedix/linux-maple.git/commit
selftests/bpf: Add tests for bpf_task_from_vpid() kfunc
authorJuntong Deng <juntong.deng@outlook.com>
Mon, 14 Oct 2024 09:25:53 +0000 (10:25 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 16 Oct 2024 16:21:18 +0000 (09:21 -0700)
commitf987a640e853e96c85f8193d0c2f79744622e3d8
tree6bcb3d1fe1766f54ad45f766acfef08a61fc96ed
parent675c3596ff32c040d1dd2e28dd57e83e634b9f60
selftests/bpf: Add tests for bpf_task_from_vpid() kfunc

This patch adds test cases for bpf_task_from_vpid() kfunc.

task_kfunc_from_vpid_no_null_check is used to test the case where
the return value is not checked for NULL pointer.

test_task_from_vpid_current is used to test obtaining the
struct task_struct of the process in the pid namespace based on vpid.

test_task_from_vpid_invalid is used to test the case of invalid vpid.

test_task_from_vpid_current and test_task_from_vpid_invalid will run
in the new namespace.

Signed-off-by: Juntong Deng <juntong.deng@outlook.com>
Link: https://lore.kernel.org/r/AM6PR03MB5848F13435CD650AC4B7BD7099442@AM6PR03MB5848.eurprd03.prod.outlook.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/prog_tests/task_kfunc.c
tools/testing/selftests/bpf/progs/task_kfunc_common.h
tools/testing/selftests/bpf/progs/task_kfunc_failure.c
tools/testing/selftests/bpf/progs/task_kfunc_success.c