From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Borkmann Subject: Re: [PATCH net-next v2 1/2] bpf: Allow CGROUP_SKB eBPF program to access sk_buff Date: Tue, 06 Jun 2017 14:04:00 +0200 Message-ID: <59369A30.1060301@iogearbox.net> References: <1496279760-20996-1-git-send-email-chenbofeng.kernel@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: Lorenzo Colitti , Chenbo Feng , ast@fb.com To: Chenbo Feng , netdev@vger.kernel.org, David Miller Return-path: Received: from www62.your-server.de ([213.133.104.62]:38393 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751439AbdFFMED (ORCPT ); Tue, 6 Jun 2017 08:04:03 -0400 In-Reply-To: <1496279760-20996-1-git-send-email-chenbofeng.kernel@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: On 06/01/2017 03:15 AM, Chenbo Feng wrote: > From: Chenbo Feng > > 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 Sorry, but I am puzzled what above change log has to do with the below diff?! Back then we decided not to add BPF_PROG_TYPE_CGROUP_SKB to may_access_skb(), since one can already use bpf_skb_load_bytes() helper to access pkt data, which is a much more flexible interface. Mind to elaborate why you cannot use bpf_skb_load_bytes() instead? > --- > kernel/bpf/verifier.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c > index 339c8a1..94a9bc9 100644 > --- a/kernel/bpf/verifier.c > +++ b/kernel/bpf/verifier.c > @@ -2419,6 +2419,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; >