All of lore.kernel.org
 help / color / mirror / Atom feed
From: Serge Hallyn <serge.hallyn-GeWIH/nMZzLQT0dZR+AlfA@public.gmane.org>
To: Glauber Costa <glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
	Aristeu Rozanski <aris-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Andrew Morton
	<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>,
	"Eric W. Biederman"
	<ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
Subject: Re: [PATCH 1/4] dev_cgroup: keep track of which cgroup is the root cgroup
Date: Fri, 15 Mar 2013 09:07:43 -0500	[thread overview]
Message-ID: <20130315140743.GC3782__9596.77808355099$1363356502$gmane$org@sergelap> (raw)
In-Reply-To: <1363338823-25292-2-git-send-email-glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>

Quoting Glauber Costa (glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org):
> Most of the other subsystems already keep track of that in some way.  We
> will do that internally and provide a test to determine whether or not
> our task is in a device cgroup that is not the root one. We can relax
> some of our checks in that case, trusting that whoever set device cgroup
> rules will be responsible to control access to their devices.
> 
> Signed-off-by: Glauber Costa <glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
> Cc: Aristeu Rozanski <aris-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> Cc: Eric Biederman <ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
> Cc: Serge Hallyn <serge.hallyn-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>

Patch looks fine.  AFAIK we're still waiting on Aristeu's patchset to
hit upstream.  As your patches are simpler I'd prefer, if there is
churn, for yours to be refactored than his.

Acked-by: Serge E. Hallyn <serge.hallyn-GeWIH/nMZzLQT0dZR+AlfA@public.gmane.org>

> Cc: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
> ---
>  include/linux/security.h |  1 +
>  security/device_cgroup.c | 15 +++++++++++++--
>  2 files changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/security.h b/include/linux/security.h
> index eee7478..fe58f71 100644
> --- a/include/linux/security.h
> +++ b/include/linux/security.h
> @@ -96,6 +96,7 @@ extern int cap_task_setscheduler(struct task_struct *p);
>  extern int cap_task_setioprio(struct task_struct *p, int ioprio);
>  extern int cap_task_setnice(struct task_struct *p, int nice);
>  extern int cap_vm_enough_memory(struct mm_struct *mm, long pages);
> +bool *task_in_child_devcgroup(struct task_struct *task);
>  
>  struct msghdr;
>  struct sk_buff;
> diff --git a/security/device_cgroup.c b/security/device_cgroup.c
> index 1c69e38..03df5b2 100644
> --- a/security/device_cgroup.c
> +++ b/security/device_cgroup.c
> @@ -63,6 +63,16 @@ static inline struct dev_cgroup *task_devcgroup(struct task_struct *task)
>  	return css_to_devcgroup(task_subsys_state(task, devices_subsys_id));
>  }
>  
> +static struct dev_cgroup *root_devcgroup;
> +bool task_in_child_devcgroup(struct task_struct *task)
> +{
> +	bool ret;
> +	rcu_read_lock();
> +	ret = task_devcgroup(task) != root_devcgroup;
> +	rcu_read_unlock();
> +	return ret;
> +}
> +
>  struct cgroup_subsys devices_subsys;
>  
>  static int devcgroup_can_attach(struct cgroup *new_cgrp,
> @@ -197,9 +207,10 @@ static struct cgroup_subsys_state *devcgroup_css_alloc(struct cgroup *cgroup)
>  	INIT_LIST_HEAD(&dev_cgroup->exceptions);
>  	parent_cgroup = cgroup->parent;
>  
> -	if (parent_cgroup == NULL)
> +	if (parent_cgroup == NULL) {
>  		dev_cgroup->behavior = DEVCG_DEFAULT_ALLOW;
> -	else {
> +		root_devcgroup = dev_cgroup;
> +	} else {
>  		parent_dev_cgroup = cgroup_to_devcgroup(parent_cgroup);
>  		mutex_lock(&devcgroup_mutex);
>  		ret = dev_exceptions_copy(&dev_cgroup->exceptions,
> -- 
> 1.8.1.2
> 

  parent reply	other threads:[~2013-03-15 14:07 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-15  9:13 [PATCH 0/4] fix depvpts in user namespaces Glauber Costa
2013-03-15  9:13 ` Glauber Costa
     [not found] ` <1363338823-25292-1-git-send-email-glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2013-03-15  9:13   ` [PATCH 1/4] dev_cgroup: keep track of which cgroup is the root cgroup Glauber Costa
2013-03-15  9:13     ` Glauber Costa
     [not found]     ` <1363338823-25292-2-git-send-email-glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2013-03-15 14:07       ` Serge Hallyn
2013-03-15 14:43         ` Glauber Costa
2013-03-15 14:43         ` Glauber Costa
2013-03-15 14:43           ` Glauber Costa
     [not found]           ` <514333A2.5060408-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2013-03-15 14:55             ` Serge Hallyn
2013-03-15 14:55           ` Serge Hallyn
2013-03-15 14:07       ` Serge Hallyn [this message]
2013-03-15 19:27       ` Aristeu Rozanski
2013-03-15  9:13   ` [PATCH 2/4] fs: allow dev accesses in userns in controlled situations Glauber Costa
2013-03-15  9:13     ` Glauber Costa
2013-03-15 14:20     ` Serge Hallyn
2013-03-19 15:32       ` Janne Karhunen
     [not found]         ` <CAE=Ncradvs_twWT8b6NQz85dm-Y8ayTH7NFv=i0vjYXpRBW9sg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-03-19 15:37           ` Serge Hallyn
2013-03-19 16:52             ` Janne Karhunen
     [not found]               ` <CAE=NcrYeKQYqkPsB9FG5PpYd2VTqmTszfpY39aRJqR=vsXfa7w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-03-19 17:27                 ` Serge Hallyn
2013-03-19 18:08                   ` Janne Karhunen
     [not found]                     ` <CAE=NcraBvk_hwCd9BgASpDBkmEB+fg-kKwAPbT7bQeFRbq5DSg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-03-19 19:15                       ` Serge Hallyn
2013-03-19 23:29                 ` Eric W. Biederman
     [not found]     ` <1363338823-25292-3-git-send-email-glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2013-03-15 14:20       ` Serge Hallyn
2013-03-15  9:13   ` [PATCH 3/4] fs: allow mknod in user namespaces Glauber Costa
2013-03-15  9:13     ` Glauber Costa
     [not found]     ` <1363338823-25292-4-git-send-email-glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2013-03-15 14:37       ` Serge Hallyn
2013-03-15 14:49         ` Glauber Costa
2013-03-15 14:49           ` Glauber Costa
     [not found]           ` <51433511.1020808-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2013-03-15 15:14             ` Serge Hallyn
2013-03-15 15:14             ` Serge Hallyn
2013-03-15 14:49         ` Glauber Costa
2013-03-15 14:37       ` Serge Hallyn
2013-03-15 18:03       ` Vasily Kulikov
2013-03-15 20:43       ` Eric W. Biederman
2013-03-15 18:03     ` Vasily Kulikov
2013-03-15 20:43     ` Eric W. Biederman
2013-03-15 20:43       ` Eric W. Biederman
2013-03-16  0:23       ` Serge Hallyn
     [not found]       ` <87a9q4gzs1.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2013-03-16  0:23         ` Serge Hallyn
2013-03-15  9:13   ` Glauber Costa
2013-03-15  9:13   ` [PATCH 4/4] devpts: fix usage " Glauber Costa
2013-03-15  9:13   ` Glauber Costa
2013-03-15  9:13     ` Glauber Costa
     [not found]     ` <1363338823-25292-5-git-send-email-glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2013-03-15 14:45       ` Serge Hallyn
2013-03-15 14:45       ` Serge Hallyn
2013-03-15 10:26   ` [PATCH 0/4] fix depvpts " Eric W. Biederman
     [not found]     ` <87boalt0vi.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2013-03-15 12:01       ` Glauber Costa
2013-03-15 14:00       ` Serge Hallyn
2013-03-15 14:00     ` Serge Hallyn
2013-03-15 14:42       ` Glauber Costa
2013-03-15 14:42         ` Glauber Costa
     [not found]         ` <5143333E.1040100-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2013-03-15 15:21           ` Serge Hallyn
2013-03-15 15:26             ` Glauber Costa
2013-03-15 15:26             ` Glauber Costa
2013-03-15 15:26               ` Glauber Costa
2013-03-15 21:02               ` Eric W. Biederman
2013-03-15 21:02                 ` Eric W. Biederman
2013-03-18  3:20                 ` Serge Hallyn
2013-03-18 21:23                   ` Eric W. Biederman
     [not found]                 ` <87txoce5qy.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2013-03-18  3:20                   ` Serge Hallyn
     [not found]               ` <51433DBE.9020109-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2013-03-15 15:58                 ` Serge Hallyn
2013-03-15 16:01                   ` Glauber Costa
2013-03-15 15:58                 ` Serge Hallyn
2013-03-15 21:02                 ` Eric W. Biederman
2013-03-15 14:42       ` Glauber Costa

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='20130315140743.GC3782__9596.77808355099$1363356502$gmane$org@sergelap' \
    --to=serge.hallyn-gewih/nmzzlqt0dzr+alfa@public.gmane.org \
    --cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
    --cc=aris-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org \
    --cc=glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org \
    --cc=linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@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.