Re: [RFC v2 09/10] landlock: Handle cgroups (performance)

2016-08-30 Thread Andy Lutomirski
On Tue, Aug 30, 2016 at 6:36 PM, Alexei Starovoitov wrote: > On Tue, Aug 30, 2016 at 02:45:14PM -0700, Andy Lutomirski wrote: >> >> One might argue that landlock shouldn't be tied to seccomp (in theory, >> attached progs could be given access to syscall_get_xyz()), but I > > proposed lsm is way mo

Re: [RFC v2 09/10] landlock: Handle cgroups (performance)

2016-08-30 Thread Alexei Starovoitov
On Tue, Aug 30, 2016 at 02:45:14PM -0700, Andy Lutomirski wrote: > > One might argue that landlock shouldn't be tied to seccomp (in theory, > attached progs could be given access to syscall_get_xyz()), but I proposed lsm is way more powerful than syscall_get_xyz. no need to dumb it down. > think

Re: [RFC v2 09/10] landlock: Handle cgroups (performance)

2016-08-30 Thread Andy Lutomirski
On Aug 30, 2016 1:56 PM, "Alexei Starovoitov" wrote: > > On Tue, Aug 30, 2016 at 10:33:31PM +0200, Mickaël Salaün wrote: > > > > > > On 30/08/2016 22:23, Andy Lutomirski wrote: > > > On Tue, Aug 30, 2016 at 1:20 PM, Mickaël Salaün wrote: > > >> > > >> On 30/08/2016 20:55, Andy Lutomirski wrote: >

Re: [RFC v2 09/10] landlock: Handle cgroups (performance)

2016-08-30 Thread Alexei Starovoitov
On Tue, Aug 30, 2016 at 10:33:31PM +0200, Mickaël Salaün wrote: > > > On 30/08/2016 22:23, Andy Lutomirski wrote: > > On Tue, Aug 30, 2016 at 1:20 PM, Mickaël Salaün wrote: > >> > >> On 30/08/2016 20:55, Andy Lutomirski wrote: > >>> On Sun, Aug 28, 2016 at 2:42 AM, Mickaël Salaün wrote: >

Re: [RFC v2 09/10] landlock: Handle cgroups (performance)

2016-08-30 Thread Mickaël Salaün
On 30/08/2016 22:23, Andy Lutomirski wrote: > On Tue, Aug 30, 2016 at 1:20 PM, Mickaël Salaün wrote: >> >> On 30/08/2016 20:55, Andy Lutomirski wrote: >>> On Sun, Aug 28, 2016 at 2:42 AM, Mickaël Salaün wrote: On 28/08/2016 10:13, Andy Lutomirski wrote: > On Aug 27, 2016 11:1

Re: [RFC v2 09/10] landlock: Handle cgroups (performance)

2016-08-30 Thread Andy Lutomirski
On Tue, Aug 30, 2016 at 1:20 PM, Mickaël Salaün wrote: > > On 30/08/2016 20:55, Andy Lutomirski wrote: >> On Sun, Aug 28, 2016 at 2:42 AM, Mickaël Salaün wrote: >>> >>> >>> On 28/08/2016 10:13, Andy Lutomirski wrote: On Aug 27, 2016 11:14 PM, "Mickaël Salaün" wrote: > > > On 27/

Re: [RFC v2 09/10] landlock: Handle cgroups (performance)

2016-08-30 Thread Mickaël Salaün
On 30/08/2016 20:55, Andy Lutomirski wrote: > On Sun, Aug 28, 2016 at 2:42 AM, Mickaël Salaün wrote: >> >> >> On 28/08/2016 10:13, Andy Lutomirski wrote: >>> On Aug 27, 2016 11:14 PM, "Mickaël Salaün" wrote: On 27/08/2016 22:43, Alexei Starovoitov wrote: > On Sat, Aug 27, 2016

Re: [RFC v2 09/10] landlock: Handle cgroups (performance)

2016-08-30 Thread Andy Lutomirski
On Sun, Aug 28, 2016 at 2:42 AM, Mickaël Salaün wrote: > > > On 28/08/2016 10:13, Andy Lutomirski wrote: >> On Aug 27, 2016 11:14 PM, "Mickaël Salaün" wrote: >>> >>> >>> On 27/08/2016 22:43, Alexei Starovoitov wrote: On Sat, Aug 27, 2016 at 09:35:14PM +0200, Mickaël Salaün wrote: > On 27

Re: [RFC v2 09/10] landlock: Handle cgroups (performance)

2016-08-28 Thread Mickaël Salaün
On 28/08/2016 10:13, Andy Lutomirski wrote: > On Aug 27, 2016 11:14 PM, "Mickaël Salaün" wrote: >> >> >> On 27/08/2016 22:43, Alexei Starovoitov wrote: >>> On Sat, Aug 27, 2016 at 09:35:14PM +0200, Mickaël Salaün wrote: On 27/08/2016 20:06, Alexei Starovoitov wrote: > On Sat, Aug 27, 20

Re: [RFC v2 09/10] landlock: Handle cgroups

2016-08-28 Thread Andy Lutomirski
On Aug 27, 2016 8:12 PM, "Alexei Starovoitov" wrote: > > On Sat, Aug 27, 2016 at 12:30:36AM -0700, Andy Lutomirski wrote: > > > cgroup is the common way to group multiple tasks. > > > Without cgroup only parent<->child relationship will be possible, > > > which will limit usability of such lsm to

Re: [RFC v2 09/10] landlock: Handle cgroups (performance)

2016-08-28 Thread Andy Lutomirski
On Aug 27, 2016 11:14 PM, "Mickaël Salaün" wrote: > > > On 27/08/2016 22:43, Alexei Starovoitov wrote: > > On Sat, Aug 27, 2016 at 09:35:14PM +0200, Mickaël Salaün wrote: > >> On 27/08/2016 20:06, Alexei Starovoitov wrote: > >>> On Sat, Aug 27, 2016 at 04:06:38PM +0200, Mickaël Salaün wrote: > >>>

Re: [RFC v2 09/10] landlock: Handle cgroups (program types)

2016-08-27 Thread Mickaël Salaün
On 27/08/2016 22:56, Alexei Starovoitov wrote: > On Sat, Aug 27, 2016 at 09:55:01PM +0200, Mickaël Salaün wrote: >> >> On 27/08/2016 20:19, Alexei Starovoitov wrote: >>> On Sat, Aug 27, 2016 at 04:34:55PM +0200, Mickaël Salaün wrote: On 27/08/2016 01:05, Alexei Starovoitov wrote: > O

Re: [RFC v2 09/10] landlock: Handle cgroups (performance)

2016-08-27 Thread Mickaël Salaün
On 27/08/2016 22:43, Alexei Starovoitov wrote: > On Sat, Aug 27, 2016 at 09:35:14PM +0200, Mickaël Salaün wrote: >> On 27/08/2016 20:06, Alexei Starovoitov wrote: >>> On Sat, Aug 27, 2016 at 04:06:38PM +0200, Mickaël Salaün wrote: As said above, Landlock will not run an eBPF programs when not

Re: [RFC v2 09/10] landlock: Handle cgroups (program types)

2016-08-27 Thread Alexei Starovoitov
On Sat, Aug 27, 2016 at 09:55:01PM +0200, Mickaël Salaün wrote: > > On 27/08/2016 20:19, Alexei Starovoitov wrote: > > On Sat, Aug 27, 2016 at 04:34:55PM +0200, Mickaël Salaün wrote: > >> > >> On 27/08/2016 01:05, Alexei Starovoitov wrote: > >>> On Fri, Aug 26, 2016 at 05:10:40PM +0200, Mickaël Sa

Re: [RFC v2 09/10] landlock: Handle cgroups (performance)

2016-08-27 Thread Alexei Starovoitov
On Sat, Aug 27, 2016 at 09:35:14PM +0200, Mickaël Salaün wrote: > > On 27/08/2016 20:06, Alexei Starovoitov wrote: > > On Sat, Aug 27, 2016 at 04:06:38PM +0200, Mickaël Salaün wrote: > >> > >> On 27/08/2016 01:05, Alexei Starovoitov wrote: > >>> On Fri, Aug 26, 2016 at 05:10:40PM +0200, Mickaël Sa

Re: [RFC v2 09/10] landlock: Handle cgroups (program types)

2016-08-27 Thread Mickaël Salaün
On 27/08/2016 20:19, Alexei Starovoitov wrote: > On Sat, Aug 27, 2016 at 04:34:55PM +0200, Mickaël Salaün wrote: >> >> On 27/08/2016 01:05, Alexei Starovoitov wrote: >>> On Fri, Aug 26, 2016 at 05:10:40PM +0200, Mickaël Salaün wrote: >>> > As far as safety and type checking that bpf programs h

Re: [RFC v2 09/10] landlock: Handle cgroups (performance)

2016-08-27 Thread Mickaël Salaün
On 27/08/2016 20:06, Alexei Starovoitov wrote: > On Sat, Aug 27, 2016 at 04:06:38PM +0200, Mickaël Salaün wrote: >> >> On 27/08/2016 01:05, Alexei Starovoitov wrote: >>> On Fri, Aug 26, 2016 at 05:10:40PM +0200, Mickaël Salaün wrote: > > - I don't think such 'for' loop can scale. The

Re: [RFC v2 09/10] landlock: Handle cgroups (netfilter match)

2016-08-27 Thread Alexei Starovoitov
On Sat, Aug 27, 2016 at 04:19:05PM +0200, Mickaël Salaün wrote: > > On 27/08/2016 01:05, Alexei Starovoitov wrote: > > On Fri, Aug 26, 2016 at 05:10:40PM +0200, Mickaël Salaün wrote: > >> To sum up, there is four related patchsets: > >> * "Landlock LSM: Unprivileged sandboxing" (this series) > >>

Re: [RFC v2 09/10] landlock: Handle cgroups (program types)

2016-08-27 Thread Alexei Starovoitov
On Sat, Aug 27, 2016 at 04:34:55PM +0200, Mickaël Salaün wrote: > > On 27/08/2016 01:05, Alexei Starovoitov wrote: > > On Fri, Aug 26, 2016 at 05:10:40PM +0200, Mickaël Salaün wrote: > > > >>> As far as safety and type checking that bpf programs has to do, > >>> I like the approach of patch 06/10:

Re: [RFC v2 09/10] landlock: Handle cgroups

2016-08-27 Thread Alexei Starovoitov
On Sat, Aug 27, 2016 at 12:30:36AM -0700, Andy Lutomirski wrote: > > cgroup is the common way to group multiple tasks. > > Without cgroup only parent<->child relationship will be possible, > > which will limit usability of such lsm to a master task that controls > > its children. Such api restricti

Re: [RFC v2 09/10] landlock: Handle cgroups (performance)

2016-08-27 Thread Alexei Starovoitov
On Sat, Aug 27, 2016 at 04:06:38PM +0200, Mickaël Salaün wrote: > > On 27/08/2016 01:05, Alexei Starovoitov wrote: > > On Fri, Aug 26, 2016 at 05:10:40PM +0200, Mickaël Salaün wrote: > >> > >>> > >>> - I don't think such 'for' loop can scale. The solution needs to work > >>> with thousands of cont

Re: [RFC v2 09/10] landlock: Handle cgroups (program types)

2016-08-27 Thread Mickaël Salaün
On 27/08/2016 01:05, Alexei Starovoitov wrote: > On Fri, Aug 26, 2016 at 05:10:40PM +0200, Mickaël Salaün wrote: > >>> As far as safety and type checking that bpf programs has to do, >>> I like the approach of patch 06/10: >>> +LANDLOCK_HOOK2(file_open, FILE_OPEN, >>> + PTR_TO_STRUCT_FILE, s

Re: [RFC v2 09/10] landlock: Handle cgroups (netfilter match)

2016-08-27 Thread Mickaël Salaün
On 27/08/2016 01:05, Alexei Starovoitov wrote: > On Fri, Aug 26, 2016 at 05:10:40PM +0200, Mickaël Salaün wrote: >> To sum up, there is four related patchsets: >> * "Landlock LSM: Unprivileged sandboxing" (this series) >> * "Add Checmate, BPF-driven minor LSM" (Sargun Dhillon) >> * "Networking cgr

Re: [RFC v2 09/10] landlock: Handle cgroups (performance)

2016-08-27 Thread Mickaël Salaün
On 27/08/2016 01:05, Alexei Starovoitov wrote: > On Fri, Aug 26, 2016 at 05:10:40PM +0200, Mickaël Salaün wrote: >> >>> >>> - I don't think such 'for' loop can scale. The solution needs to work >>> with thousands of containers and thousands of cgroups. >>> In the patch 06/10 the proposal is to use

Re: [RFC v2 09/10] landlock: Handle cgroups

2016-08-27 Thread Andy Lutomirski
On Aug 27, 2016 1:05 AM, "Alexei Starovoitov" wrote: > > On Fri, Aug 26, 2016 at 05:10:40PM +0200, Mickaël Salaün wrote: > > > > trimming cc list again. When it's too big vger will consider it as spam. > > > On 26/08/2016 04:14, Alexei Starovoitov wrote: > > > On Thu, Aug 25, 2016 at 12:32:44PM +0

Re: [RFC v2 09/10] landlock: Handle cgroups

2016-08-26 Thread Alexei Starovoitov
On Fri, Aug 26, 2016 at 05:10:40PM +0200, Mickaël Salaün wrote: > trimming cc list again. When it's too big vger will consider it as spam. > On 26/08/2016 04:14, Alexei Starovoitov wrote: > > On Thu, Aug 25, 2016 at 12:32:44PM +0200, Mickaël Salaün wrote: > >> Add an eBPF function bpf_landlock_c

Re: [RFC v2 09/10] landlock: Handle cgroups

2016-08-26 Thread Tejun Heo
Hello, On Fri, Aug 26, 2016 at 07:20:35AM -0700, Andy Lutomirski wrote: > > This is simply the action of changing the owner of cgroup sysfs files to > > allow an unprivileged user to handle them (cf. Documentation/cgroup-v2.txt) > > As far as I can tell, Tejun and systemd both actively discourage

Re: [RFC v2 09/10] landlock: Handle cgroups

2016-08-26 Thread Mickaël Salaün
On 26/08/2016 04:14, Alexei Starovoitov wrote: > On Thu, Aug 25, 2016 at 12:32:44PM +0200, Mickaël Salaün wrote: >> Add an eBPF function bpf_landlock_cmp_cgroup_beneath(opt, map, map_op) >> to compare the current process cgroup with a cgroup handle, The handle >> can match the current cgroup if it

Re: [RFC v2 09/10] landlock: Handle cgroups

2016-08-26 Thread Andy Lutomirski
On Thu, Aug 25, 2016 at 7:44 AM, Mickaël Salaün wrote: > > On 25/08/2016 13:09, Andy Lutomirski wrote: >> On Thu, Aug 25, 2016 at 3:32 AM, Mickaël Salaün wrote: >>> Add an eBPF function bpf_landlock_cmp_cgroup_beneath(opt, map, map_op) >>> to compare the current process cgroup with a cgroup handl

Re: [RFC v2 09/10] landlock: Handle cgroups

2016-08-26 Thread Tejun Heo
Hello, On Thu, Aug 25, 2016 at 04:44:13PM +0200, Mickaël Salaün wrote: > I tested with cgroup-v2 but indeed, it seems a bit different with > cgroup-v1 :) > Does anyone know how to handle both cases? If you wanna do cgroup membership test, just do cgroup v2 membership test. No need to introduce a

Re: [RFC v2 09/10] landlock: Handle cgroups

2016-08-25 Thread Alexei Starovoitov
On Thu, Aug 25, 2016 at 12:32:44PM +0200, Mickaël Salaün wrote: > Add an eBPF function bpf_landlock_cmp_cgroup_beneath(opt, map, map_op) > to compare the current process cgroup with a cgroup handle, The handle > can match the current cgroup if it is the same or a child. This allows > to make condit

Re: [RFC v2 09/10] landlock: Handle cgroups

2016-08-25 Thread Mickaël Salaün
On 25/08/2016 13:09, Andy Lutomirski wrote: > On Thu, Aug 25, 2016 at 3:32 AM, Mickaël Salaün wrote: >> Add an eBPF function bpf_landlock_cmp_cgroup_beneath(opt, map, map_op) >> to compare the current process cgroup with a cgroup handle, The handle >> can match the current cgroup if it is the sam

Re: [RFC v2 09/10] landlock: Handle cgroups

2016-08-25 Thread Andy Lutomirski
On Thu, Aug 25, 2016 at 3:32 AM, Mickaël Salaün wrote: > Add an eBPF function bpf_landlock_cmp_cgroup_beneath(opt, map, map_op) > to compare the current process cgroup with a cgroup handle, The handle > can match the current cgroup if it is the same or a child. This allows > to make conditional ru

[RFC v2 09/10] landlock: Handle cgroups

2016-08-25 Thread Mickaël Salaün
Add an eBPF function bpf_landlock_cmp_cgroup_beneath(opt, map, map_op) to compare the current process cgroup with a cgroup handle, The handle can match the current cgroup if it is the same or a child. This allows to make conditional rules according to the current cgroup. A cgroup handle is a map e