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.
Showing the changes to include/uapi/linux (1 of 2 files). Show all
Unified · Split
| @@ -357,6 +357,13 @@ enum bpf_func_id { · 356 unmodified lines | ||
| 357 | 357 | */ |
| 358 | 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 | 367 | __BPF_FUNC_MAX_ID, |
| 361 | 368 | }; |
| 362 | 369 | |