mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-22 22:51:37 +00:00
bpf: Add bpf_current_task_under_cgroup helper
This adds a bpf helper that's similar to the skb_in_cgroup helper to check whether the probe is currently executing in the context of a specific subset of the cgroupsv2 hierarchy. It does this based on membership test for a cgroup arraymap. It is invalid to call this in an interrupt, and it'll return an error. The helper is primarily to be used in debugging activities for containers, where you may have multiple programs running in a given top-level "container". Signed-off-by: Sargun Dhillon <sargun@sargun.me> Cc: Alexei Starovoitov <ast@kernel.org> Cc: Daniel Borkmann <daniel@iogearbox.net> Cc: Tejun Heo <tj@kernel.org> Acked-by: Tejun Heo <tj@kernel.org> Acked-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
aed704b7a6
commit
60d20f9195
4 changed files with 45 additions and 2 deletions
|
@ -538,7 +538,7 @@ static int __init register_perf_event_array_map(void)
|
|||
}
|
||||
late_initcall(register_perf_event_array_map);
|
||||
|
||||
#ifdef CONFIG_SOCK_CGROUP_DATA
|
||||
#ifdef CONFIG_CGROUPS
|
||||
static void *cgroup_fd_array_get_ptr(struct bpf_map *map,
|
||||
struct file *map_file /* not used */,
|
||||
int fd)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue