diff options
| author | Alexei Starovoitov <ast@fb.com> | 2016-07-07 01:38:36 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2016-07-09 00:00:16 -0400 |
| commit | 606274c5abd8e245add01bc7145a8cbb92b69ba8 (patch) | |
| tree | 762718058c0cf327284f07fa6c1eb2410ee3e0b7 /include/uapi/linux/bpf.h | |
| parent | d390238c4fba7c87a3bcd859ce3373c864eb7b02 (diff) | |
bpf: introduce bpf_get_current_task() helper
over time there were multiple requests to access different data
structures and fields of task_struct current, so finally add
the helper to access 'current' as-is. Tracing bpf programs will do
the rest of walking the pointers via bpf_probe_read().
Note that current can be null and bpf program has to deal it with,
but even dumb passing null into bpf_probe_read() is still safe.
Suggested-by: Brendan Gregg <brendan.d.gregg@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/uapi/linux/bpf.h')
| -rw-r--r-- | include/uapi/linux/bpf.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index c14ca1cd6297..262a7e883b19 100644 --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h | |||
| @@ -357,6 +357,13 @@ enum bpf_func_id { | |||
| 357 | */ | 357 | */ |
| 358 | BPF_FUNC_get_hash_recalc, | 358 | BPF_FUNC_get_hash_recalc, |
| 359 | 359 | ||
| 360 | /** | ||
| 361 | * u64 bpf_get_current_task(void) | ||
| 362 | * Returns current task_struct | ||
| 363 | * Return: current | ||
| 364 | */ | ||
| 365 | BPF_FUNC_get_current_task, | ||
| 366 | |||
| 360 | __BPF_FUNC_MAX_ID, | 367 | __BPF_FUNC_MAX_ID, |
| 361 | }; | 368 | }; |
| 362 | 369 | ||
