From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758028Ab2IEC7x (ORCPT ); Tue, 4 Sep 2012 22:59:53 -0400 Received: from 50-56-35-84.static.cloud-ips.com ([50.56.35.84]:34195 "EHLO mail.hallyn.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751263Ab2IEC7v (ORCPT ); Tue, 4 Sep 2012 22:59:51 -0400 Date: Wed, 5 Sep 2012 03:00:25 +0000 From: "Serge E. Hallyn" To: Aristeu Rozanski Cc: linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, Tejun Heo , Li Zefan , James Morris , Pavel Emelyanov , Serge Hallyn , Andrew Morton Subject: Re: [PATCH v2 1/6] device_cgroup: add "behavior" in dev_cgroup structure Message-ID: <20120905030025.GA13310@mail.hallyn.com> References: <20120904143419.892872876@napanee.usersys.redhat.com> <20120904143420.234142640@napanee.usersys.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120904143420.234142640@napanee.usersys.redhat.com> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Aristeu Rozanski (aris@redhat.com): > behavior will determine if the default policy is to deny all device access > unless for the ones in the exception list. > > This variable will be used in the next patches to convert device_cgroup > internally into a default policy + rules. > > v2: > - renamed deny_all to behavior > > Cc: Tejun Heo > Cc: Li Zefan > Cc: James Morris > Cc: Pavel Emelyanov > Cc: Serge Hallyn Acked-by: Serge Hallyn > Signed-off-by: Aristeu Rozanski > > --- > security/device_cgroup.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > Index: github/security/device_cgroup.c > =================================================================== > --- github.orig/security/device_cgroup.c 2012-08-21 09:49:38.698415513 -0400 > +++ github/security/device_cgroup.c 2012-08-21 10:50:34.650810797 -0400 > @@ -42,6 +42,10 @@ > struct dev_cgroup { > struct cgroup_subsys_state css; > struct list_head whitelist; > + enum { > + DEVCG_DEFAULT_ALLOW, > + DEVCG_DEFAULT_DENY, > + } behavior; > }; > > static inline struct dev_cgroup *css_to_devcgroup(struct cgroup_subsys_state *s) > @@ -178,12 +182,14 @@ > wh->minor = wh->major = ~0; > wh->type = DEV_ALL; > wh->access = ACC_MASK; > + dev_cgroup->behavior = DEVCG_DEFAULT_ALLOW; > list_add(&wh->list, &dev_cgroup->whitelist); > } else { > parent_dev_cgroup = cgroup_to_devcgroup(parent_cgroup); > mutex_lock(&devcgroup_mutex); > ret = dev_whitelist_copy(&dev_cgroup->whitelist, > &parent_dev_cgroup->whitelist); > + dev_cgroup->behavior = parent_dev_cgroup->behavior; > mutex_unlock(&devcgroup_mutex); > if (ret) { > kfree(dev_cgroup); > @@ -409,9 +415,11 @@ > case DEVCG_ALLOW: > if (!parent_has_perm(devcgroup, &wh)) > return -EPERM; > + devcgroup->behavior = DEVCG_DEFAULT_ALLOW; > return dev_whitelist_add(devcgroup, &wh); > case DEVCG_DENY: > dev_whitelist_rm(devcgroup, &wh); > + devcgroup->behavior = DEVCG_DEFAULT_DENY; > break; > default: > return -EINVAL; > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/