diff options
author | David Vernet <void@manifault.com> | 2022-11-22 15:52:59 +0100 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2022-11-24 02:45:23 +0100 |
commit | 3f0e6f2b41d35d4446160c745e8f09037447dd8f (patch) | |
tree | b175c6182c6108a34cfe5d9eda1218fd17cd0151 /tools/testing/selftests/bpf/progs/task_kfunc_success.c | |
parent | bpf: Unify and simplify btf_func_proto_check error handling (diff) | |
download | linux-3f0e6f2b41d35d4446160c745e8f09037447dd8f.tar.xz linux-3f0e6f2b41d35d4446160c745e8f09037447dd8f.zip |
bpf: Add bpf_task_from_pid() kfunc
Callers can currently store tasks as kptrs using bpf_task_acquire(),
bpf_task_kptr_get(), and bpf_task_release(). These are useful if a
caller already has a struct task_struct *, but there may be some callers
who only have a pid, and want to look up the associated struct
task_struct * from that to e.g. find task->comm.
This patch therefore adds a new bpf_task_from_pid() kfunc which allows
BPF programs to get a struct task_struct * kptr from a pid.
Signed-off-by: David Vernet <void@manifault.com>
Link: https://lore.kernel.org/r/20221122145300.251210-2-void@manifault.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/progs/task_kfunc_success.c')
0 files changed, 0 insertions, 0 deletions