Commit 3f0e6f2
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>1 parent 5bad358 commit 3f0e6f2
1 file changed
+20
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1959 | 1959 | | |
1960 | 1960 | | |
1961 | 1961 | | |
| 1962 | + | |
| 1963 | + | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
| 1967 | + | |
| 1968 | + | |
| 1969 | + | |
| 1970 | + | |
| 1971 | + | |
| 1972 | + | |
| 1973 | + | |
| 1974 | + | |
| 1975 | + | |
| 1976 | + | |
| 1977 | + | |
| 1978 | + | |
| 1979 | + | |
| 1980 | + | |
1962 | 1981 | | |
1963 | 1982 | | |
1964 | 1983 | | |
| |||
1984 | 2003 | | |
1985 | 2004 | | |
1986 | 2005 | | |
1987 | | - | |
1988 | 2006 | | |
1989 | 2007 | | |
1990 | 2008 | | |
1991 | 2009 | | |
1992 | 2010 | | |
1993 | 2011 | | |
| 2012 | + | |
1994 | 2013 | | |
1995 | 2014 | | |
1996 | 2015 | | |
| |||
0 commit comments