diff options
author | 2022-11-22 08:53:00 -0600 | |
---|---|---|
committer | 2022-11-23 17:45:30 -0800 | |
commit | f471748b7fe5ab7ec6de4cbadffabfa7bb5b6240 (patch) | |
tree | 405d7dd4a2b41b2e8561448f9c32bcea5b36790b /tools/testing/selftests/bpf/prog_tests/task_kfunc.c | |
parent | bpf: Add bpf_task_from_pid() kfunc (diff) | |
download | linux-f471748b7fe5ab7ec6de4cbadffabfa7bb5b6240.tar.gz linux-f471748b7fe5ab7ec6de4cbadffabfa7bb5b6240.tar.bz2 linux-f471748b7fe5ab7ec6de4cbadffabfa7bb5b6240.zip |
selftests/bpf: Add selftests for bpf_task_from_pid()
Add some selftest testcases that validate the expected behavior of the
bpf_task_from_pid() kfunc that was added in the prior patch.
Signed-off-by: David Vernet <void@manifault.com>
Link: https://lore.kernel.org/r/20221122145300.251210-3-void@manifault.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/task_kfunc.c')
-rw-r--r-- | tools/testing/selftests/bpf/prog_tests/task_kfunc.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/task_kfunc.c b/tools/testing/selftests/bpf/prog_tests/task_kfunc.c index 4994fe6092cc..ffd8ef4303c8 100644 --- a/tools/testing/selftests/bpf/prog_tests/task_kfunc.c +++ b/tools/testing/selftests/bpf/prog_tests/task_kfunc.c @@ -78,6 +78,9 @@ static const char * const success_tests[] = { "test_task_xchg_release", "test_task_get_release", "test_task_current_acquire_release", + "test_task_from_pid_arg", + "test_task_from_pid_current", + "test_task_from_pid_invalid", }; static struct { @@ -99,6 +102,7 @@ static struct { {"task_kfunc_release_fp", "arg#0 pointer type STRUCT task_struct must point"}, {"task_kfunc_release_null", "arg#0 is ptr_or_null_ expected ptr_ or socket"}, {"task_kfunc_release_unacquired", "release kernel function bpf_task_release expects"}, + {"task_kfunc_from_pid_no_null_check", "arg#0 is ptr_or_null_ expected ptr_ or socket"}, }; static void verify_fail(const char *prog_name, const char *expected_err_msg) |