All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aleksa Sarai <asarai-l3A5Bk7waGM@public.gmane.org>
To: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>,
	Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
Cc: James Bottomley
	<James.Bottomley-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org>,
	Aleksa Sarai <cyphar-gVpy/LI/lHzQT0dZR+AlfA@public.gmane.org>,
	cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	dev-IGmTWi+3HBZvNhPySn5qfx2eb7JE58TQ@public.gmane.org
Subject: Re: [PATCH v4 0/2] cgroup: allow management of subtrees by new cgroup namespaces
Date: Sat, 21 May 2016 00:48:48 +1000	[thread overview]
Message-ID: <573F23D0.2030500@suse.de> (raw)
In-Reply-To: <1463196000-13900-1-git-send-email-asarai-l3A5Bk7waGM@public.gmane.org>

> This is an updated (and rewritten) version of v3 of this patchset[1].
>
> The main difference is that I changed how we the "allow management" is
> implemented. Rather than just chmod-ing the cgroup directory (which
> everyone agreed was quite an odd way of doing it),
> unshare(CLONE_NEWCGROUP) will create a new subtree in every cgroup the
> task is associated with. The task will then be migrated to those
> subtrees (which form the root cset of the cgroup namespace). This change
> will be transparent to namespaced processes, and they'll gain a new
> ability (the ability to create cgroups).
>
> The name of the cgroup is randomly generated to ensure we don't get
> conflicts (but maybe this should be dealt with in a nicer way). In
> addition, I've updated the cgroup.procs write permission checks to be
> user namespace aware, but I also added an additional "permitted" case
> (where all of the tasks are in the same cgroup namespace and %current
> has CAP_SYS_ADMIN in all of the relevant user namespaces).
>
> I'm not _completely_ convinced about the addition of that case, and
> maybe we should drop it (but I might be biased since this all comes from
> the requirements of rootless containers).
>
> Also, I haven't added a way to disable the functionality on a per-cgroup
> (or even global) basis. Maybe there should be a way to do that, but I'm
> not sure how it should be done (a cgroup.ns_subtrees file that allows
> administrators to change it on a per-cgroup basis, or just a sysctl?).
>
> PTAL.
>
> [1]: https://lkml.org/lkml/2016/5/2/280
>
> Aleksa Sarai (2):
>    cgroup: make cgroup.procs permissions userns-aware
>    cgroup: implement subtree creation on copy_cgroup_ns()
>
>   kernel/cgroup.c | 149 +++++++++++++++++++++++++++++++++++++++++++++++---------
>   1 file changed, 126 insertions(+), 23 deletions(-)
>

Are there any comments on this version of the patchset? I thought we had 
reached an agreement that the underlying feature (allowing a process to 
manage its own cgroups) was useful. Is there a better way of solving 
this problem, that I don't know of?

-- 
Aleksa Sarai
Software Engineer (Containers)
SUSE Linux GmbH
https://www.cyphar.com/

WARNING: multiple messages have this Message-ID (diff)
From: Aleksa Sarai <asarai@suse.de>
To: Tejun Heo <tj@kernel.org>, Li Zefan <lizefan@huawei.com>,
	Johannes Weiner <hannes@cmpxchg.org>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>,
	Aleksa Sarai <cyphar@cyphar.com>,
	cgroups@vger.kernel.org, linux-kernel@vger.kernel.org,
	dev@opencontainers.org
Subject: Re: [PATCH v4 0/2] cgroup: allow management of subtrees by new cgroup namespaces
Date: Sat, 21 May 2016 00:48:48 +1000	[thread overview]
Message-ID: <573F23D0.2030500@suse.de> (raw)
In-Reply-To: <1463196000-13900-1-git-send-email-asarai@suse.de>

> This is an updated (and rewritten) version of v3 of this patchset[1].
>
> The main difference is that I changed how we the "allow management" is
> implemented. Rather than just chmod-ing the cgroup directory (which
> everyone agreed was quite an odd way of doing it),
> unshare(CLONE_NEWCGROUP) will create a new subtree in every cgroup the
> task is associated with. The task will then be migrated to those
> subtrees (which form the root cset of the cgroup namespace). This change
> will be transparent to namespaced processes, and they'll gain a new
> ability (the ability to create cgroups).
>
> The name of the cgroup is randomly generated to ensure we don't get
> conflicts (but maybe this should be dealt with in a nicer way). In
> addition, I've updated the cgroup.procs write permission checks to be
> user namespace aware, but I also added an additional "permitted" case
> (where all of the tasks are in the same cgroup namespace and %current
> has CAP_SYS_ADMIN in all of the relevant user namespaces).
>
> I'm not _completely_ convinced about the addition of that case, and
> maybe we should drop it (but I might be biased since this all comes from
> the requirements of rootless containers).
>
> Also, I haven't added a way to disable the functionality on a per-cgroup
> (or even global) basis. Maybe there should be a way to do that, but I'm
> not sure how it should be done (a cgroup.ns_subtrees file that allows
> administrators to change it on a per-cgroup basis, or just a sysctl?).
>
> PTAL.
>
> [1]: https://lkml.org/lkml/2016/5/2/280
>
> Aleksa Sarai (2):
>    cgroup: make cgroup.procs permissions userns-aware
>    cgroup: implement subtree creation on copy_cgroup_ns()
>
>   kernel/cgroup.c | 149 +++++++++++++++++++++++++++++++++++++++++++++++---------
>   1 file changed, 126 insertions(+), 23 deletions(-)
>

Are there any comments on this version of the patchset? I thought we had 
reached an agreement that the underlying feature (allowing a process to 
manage its own cgroups) was useful. Is there a better way of solving 
this problem, that I don't know of?

-- 
Aleksa Sarai
Software Engineer (Containers)
SUSE Linux GmbH
https://www.cyphar.com/

  parent reply	other threads:[~2016-05-20 14:48 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-14  3:19 [PATCH v4 0/2] cgroup: allow management of subtrees by new cgroup namespaces Aleksa Sarai
2016-05-14  3:19 ` Aleksa Sarai
2016-05-14  3:19 ` [PATCH v4 1/2] cgroup: make cgroup.procs permissions userns-aware Aleksa Sarai
     [not found] ` <1463196000-13900-1-git-send-email-asarai-l3A5Bk7waGM@public.gmane.org>
2016-05-14  3:20   ` [PATCH v4 2/2] cgroup: implement subtree creation on copy_cgroup_ns() Aleksa Sarai
2016-05-14  3:20     ` Aleksa Sarai
2016-05-20 14:48   ` Aleksa Sarai [this message]
2016-05-20 14:48     ` [PATCH v4 0/2] cgroup: allow management of subtrees by new cgroup namespaces Aleksa Sarai
     [not found]     ` <573F23D0.2030500-l3A5Bk7waGM@public.gmane.org>
2016-05-20 15:22       ` Tejun Heo
2016-05-20 15:22         ` Tejun Heo
     [not found]         ` <20160520152244.GB5632-piEFEHQLUPpN0TnZuCh8vA@public.gmane.org>
2016-05-20 15:30           ` James Bottomley
2016-05-20 15:30             ` James Bottomley
     [not found]             ` <1463758258.8091.3.camel-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org>
2016-05-20 16:03               ` Tejun Heo
2016-05-20 16:03                 ` Tejun Heo
2016-05-20 16:09                 ` James Bottomley
2016-05-20 16:17                   ` Tejun Heo
     [not found]                     ` <20160520161759.GD5632-piEFEHQLUPpN0TnZuCh8vA@public.gmane.org>
2016-05-20 16:25                       ` James Bottomley
2016-05-20 16:25                         ` James Bottomley
     [not found]                         ` <1463761509.8091.19.camel-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org>
2016-05-20 16:29                           ` Aleksa Sarai
2016-05-20 16:29                             ` Aleksa Sarai
2016-05-20 16:53                         ` Tejun Heo
     [not found]                           ` <20160520165326.GE5632-piEFEHQLUPpN0TnZuCh8vA@public.gmane.org>
2016-05-20 17:28                             ` James Bottomley
2016-05-20 17:28                               ` James Bottomley
     [not found]                               ` <1463765326.8091.42.camel-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org>
2016-05-20 17:49                                 ` Tejun Heo
2016-05-20 17:49                                   ` Tejun Heo
2016-05-28  5:12                                   ` Aleksa Sarai
2016-05-31 18:18                                     ` Tejun Heo
2016-05-20 17:33                             ` W. Trevor King
2016-05-20 17:33                               ` W. Trevor King
2016-05-20 17:33                         ` Aditya Kali
2016-05-20 17:50                           ` James Bottomley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=573F23D0.2030500@suse.de \
    --to=asarai-l3a5bk7wagm@public.gmane.org \
    --cc=James.Bottomley-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=cyphar-gVpy/LI/lHzQT0dZR+AlfA@public.gmane.org \
    --cc=dev-IGmTWi+3HBZvNhPySn5qfx2eb7JE58TQ@public.gmane.org \
    --cc=hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
    --cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.