Re: [PATCH v2 net-next 1/8] bpf: Add support for recursively running cgroup sock filters

2017-09-01 Thread Tejun Heo
Hello, Alexei. On Thu, Aug 31, 2017 at 08:27:56PM -0700, Alexei Starovoitov wrote: > > > The 2 flags are completely independent. The existing override logic is > > > unchanged. If a program can not be overridden, then the new recursive > > > flag is irrelevant. > > > > I'm not sure all four

Re: [PATCH v2 net-next 1/8] bpf: Add support for recursively running cgroup sock filters

2017-08-31 Thread Alexei Starovoitov
On Thu, Aug 31, 2017 at 07:22:01AM -0700, Tejun Heo wrote: > Hello, David, Alexei. > > Sorry about late reply. > > On Sun, Aug 27, 2017 at 08:49:23AM -0600, David Ahern wrote: > > On 8/25/17 8:49 PM, Alexei Starovoitov wrote: > > > > > >> +if (prog && curr_recursive && !new_recursive) >

Re: [PATCH v2 net-next 1/8] bpf: Add support for recursively running cgroup sock filters

2017-08-31 Thread David Ahern
On 8/31/17 8:22 AM, Tejun Heo wrote: > On Sun, Aug 27, 2017 at 08:49:23AM -0600, David Ahern wrote: >> On 8/25/17 8:49 PM, Alexei Starovoitov wrote: >>> + if (prog && curr_recursive && !new_recursive) + /* if a parent has recursive prog attached, only + * allow

Re: [PATCH v2 net-next 1/8] bpf: Add support for recursively running cgroup sock filters

2017-08-31 Thread Tejun Heo
Hello, David, Alexei. Sorry about late reply. On Sun, Aug 27, 2017 at 08:49:23AM -0600, David Ahern wrote: > On 8/25/17 8:49 PM, Alexei Starovoitov wrote: > > > >> + if (prog && curr_recursive && !new_recursive) > >> + /* if a parent has recursive prog attached, only > >> +

Re: [PATCH v2 net-next 1/8] bpf: Add support for recursively running cgroup sock filters

2017-08-29 Thread Alexei Starovoitov
On Tue, Aug 29, 2017 at 09:38:16PM -0600, David Ahern wrote: > On 8/29/17 8:58 PM, Alexei Starovoitov wrote: > > On Tue, Aug 29, 2017 at 07:03:43PM -0600, David Ahern wrote: > >> On 8/28/17 10:11 PM, Alexei Starovoitov wrote: > >>> > >>> Agree on the above, but you're mixing semantics of the new

Re: [PATCH v2 net-next 1/8] bpf: Add support for recursively running cgroup sock filters

2017-08-29 Thread David Ahern
On 8/29/17 8:58 PM, Alexei Starovoitov wrote: > On Tue, Aug 29, 2017 at 07:03:43PM -0600, David Ahern wrote: >> On 8/28/17 10:11 PM, Alexei Starovoitov wrote: >>> >>> Agree on the above, but you're mixing semantics of the new recurse >>> flag and implementation of it. Ex: we don't have to copy

Re: [PATCH v2 net-next 1/8] bpf: Add support for recursively running cgroup sock filters

2017-08-29 Thread Alexei Starovoitov
On Tue, Aug 29, 2017 at 07:03:43PM -0600, David Ahern wrote: > On 8/28/17 10:11 PM, Alexei Starovoitov wrote: > > > > Agree on the above, but you're mixing semantics of the new recurse > > flag and implementation of it. Ex: we don't have to copy this flag > > from prog->attr into cgroup. So this

Re: [PATCH v2 net-next 1/8] bpf: Add support for recursively running cgroup sock filters

2017-08-29 Thread David Ahern
On 8/28/17 10:11 PM, Alexei Starovoitov wrote: > > Agree on the above, but you're mixing semantics of the new recurse > flag and implementation of it. Ex: we don't have to copy this flag > from prog->attr into cgroup. So this reset or non-reset discussion > only makes sense in the context of your

Re: [PATCH v2 net-next 1/8] bpf: Add support for recursively running cgroup sock filters

2017-08-28 Thread Alexei Starovoitov
On Mon, Aug 28, 2017 at 08:22:31PM -0600, David Ahern wrote: > On 8/28/17 7:12 PM, Alexei Starovoitov wrote: > To consider what happens on doubling back and changing programs in the > hierarchy, start with $MNT/a/b/c from 3 above (non-recursive on 'a', > recursive on 'b' and

Re: [PATCH v2 net-next 1/8] bpf: Add support for recursively running cgroup sock filters

2017-08-28 Thread David Ahern
On 8/28/17 7:12 PM, Alexei Starovoitov wrote: To consider what happens on doubling back and changing programs in the hierarchy, start with $MNT/a/b/c from 3 above (non-recursive on 'a', recursive on 'b' and recursive on 'c') for each of the following cases: 1. Program

Re: [PATCH v2 net-next 1/8] bpf: Add support for recursively running cgroup sock filters

2017-08-28 Thread Alexei Starovoitov
On Mon, Aug 28, 2017 at 06:43:42PM -0600, David Ahern wrote: > On 8/28/17 5:56 PM, Alexei Starovoitov wrote: > > On Sun, Aug 27, 2017 at 08:49:23AM -0600, David Ahern wrote: > >> > >> The override flag is independent of the recursive flag. If the override > >> flag does not allow an override, the

Re: [PATCH v2 net-next 1/8] bpf: Add support for recursively running cgroup sock filters

2017-08-28 Thread David Ahern
On 8/28/17 5:56 PM, Alexei Starovoitov wrote: > On Sun, Aug 27, 2017 at 08:49:23AM -0600, David Ahern wrote: >> >> The override flag is independent of the recursive flag. If the override >> flag does not allow an override, the attempt to add a new program fails. >> The recursive flag brings an

Re: [PATCH v2 net-next 1/8] bpf: Add support for recursively running cgroup sock filters

2017-08-28 Thread Alexei Starovoitov
On Sun, Aug 27, 2017 at 08:49:23AM -0600, David Ahern wrote: > > The override flag is independent of the recursive flag. If the override > flag does not allow an override, the attempt to add a new program fails. > The recursive flag brings an additional constraint: once a cgroup has a > program

Re: [PATCH v2 net-next 1/8] bpf: Add support for recursively running cgroup sock filters

2017-08-27 Thread David Ahern
On 8/25/17 8:49 PM, Alexei Starovoitov wrote: > >> +if (prog && curr_recursive && !new_recursive) >> +/* if a parent has recursive prog attached, only >> + * allow recursive programs in descendent cgroup >> + */ >> +return -EINVAL; >> + >>

Re: [PATCH v2 net-next 1/8] bpf: Add support for recursively running cgroup sock filters

2017-08-27 Thread David Ahern
On 8/25/17 8:00 PM, Daniel Borkmann wrote: > Can you elaborate on the semantical changes for the programs > setting the new flag which are not using below cgroup_bpf_run_filter_sk() > helper to walk back to root? You mean other cgroup based programs -- BPF_CGROUP_* ? If so, any reason not to

Re: [PATCH v2 net-next 1/8] bpf: Add support for recursively running cgroup sock filters

2017-08-25 Thread Alexei Starovoitov
On Fri, Aug 25, 2017 at 12:05:34PM -0700, David Ahern wrote: > Add support for recursively applying sock filters attached to a cgroup. > For now, start with the inner cgroup attached to the socket and work back > to the root or first cgroup without the recursive flag set. Once the > recursive flag

Re: [PATCH v2 net-next 1/8] bpf: Add support for recursively running cgroup sock filters

2017-08-25 Thread Daniel Borkmann
On 08/25/2017 09:05 PM, David Ahern wrote: Add support for recursively applying sock filters attached to a cgroup. For now, start with the inner cgroup attached to the socket and work back to the root or first cgroup without the recursive flag set. Once the recursive flag is set for a cgroup all

[PATCH v2 net-next 1/8] bpf: Add support for recursively running cgroup sock filters

2017-08-25 Thread David Ahern
Add support for recursively applying sock filters attached to a cgroup. For now, start with the inner cgroup attached to the socket and work back to the root or first cgroup without the recursive flag set. Once the recursive flag is set for a cgroup all descendant group's must have the flag as