mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 14:53:58 -04:00
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>
This commit is contained in:
committed by
Alexei Starovoitov
parent
3f0e6f2b41
commit
f471748b7f
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user