summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChenbo Feng <fengc@google.com>2017-05-31 18:15:59 -0700
committerDavid S. Miller <davem@davemloft.net>2017-06-02 14:24:40 -0400
commitfb9a307d11d62749d75b404f15517d73f5d6e148 (patch)
tree6ccbff4ca2822fe980aebf7acb3b6c0d9b224dec
parentd0a65400eba812e86aa5676524dad09af3292f5a (diff)
downloadlinux-stable-fb9a307d11d62749d75b404f15517d73f5d6e148.tar.gz
linux-stable-fb9a307d11d62749d75b404f15517d73f5d6e148.tar.bz2
linux-stable-fb9a307d11d62749d75b404f15517d73f5d6e148.zip
bpf: Allow CGROUP_SKB eBPF program to access sk_buff
This allows cgroup eBPF program to classify packet based on their protocol or other detail information. Currently program need CAP_NET_ADMIN privilege to attach a cgroup eBPF program, and A process with CAP_NET_ADMIN can already see all packets on the system, for example, by creating an iptables rules that causes the packet to be passed to userspace via NFLOG. Signed-off-by: Chenbo Feng <fengc@google.com> Acked-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--kernel/bpf/verifier.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 14ccb0759fa4..8acae64df255 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -2426,6 +2426,7 @@ static bool may_access_skb(enum bpf_prog_type type)
case BPF_PROG_TYPE_SOCKET_FILTER:
case BPF_PROG_TYPE_SCHED_CLS:
case BPF_PROG_TYPE_SCHED_ACT:
+ case BPF_PROG_TYPE_CGROUP_SKB:
return true;
default:
return false;