]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Add bpf_current_task_under_cgroup helper
authorSargun Dhillon <sargun@sargun.me>
Fri, 12 Aug 2016 15:56:52 +0000 (08:56 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 13 Aug 2016 04:49:41 +0000 (21:49 -0700)
commit33f01c4af780017d8d3f70bfe0756c5cbd8da2fd
tree6f93dff429db884cf36aabdbb93c7ad9695904f7
parentd83feaec9e407f4217ccdc6d40262085e1e6dcf8
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>
include/uapi/linux/bpf.h
kernel/bpf/arraymap.c
kernel/bpf/verifier.c
kernel/trace/bpf_trace.c