Linux cgroups development
 help / color / mirror / Atom feed
From: aris@ruivo.org
To: linux-kernel@vger.kernel.org, cgroups@vger.kernel.org
Cc: Tejun Heo <tj@kernel.org>, Li Zefan <lizefan@huawei.com>
Subject: [PATCH RESEND 1/4] device_cgroup: add "deny_all" in dev_cgroup structure
Date: Thu, 09 Aug 2012 15:04:15 -0400	[thread overview]
Message-ID: <20120809190415.021701086@muttley.lan.cathedral> (raw)
In-Reply-To: 20120809190414.773462171@muttley.lan.cathedral

[-- Attachment #1: deny_all.patch --]
[-- Type: text/plain, Size: 1633 bytes --]

deny_all 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.

Signed-off-by: Aristeu Rozanski <aris@redhat.com>

---
 security/device_cgroup.c |    5 +++++
 1 file changed, 5 insertions(+)

Index: github/security/device_cgroup.c
===================================================================
--- github.orig/security/device_cgroup.c	2012-07-24 17:15:58.277108951 -0400
+++ github/security/device_cgroup.c	2012-07-24 17:16:00.085156162 -0400
@@ -42,6 +42,7 @@
 struct dev_cgroup {
 	struct cgroup_subsys_state css;
 	struct list_head whitelist;
+	bool deny_all;
 };
 
 static inline struct dev_cgroup *css_to_devcgroup(struct cgroup_subsys_state *s)
@@ -178,12 +179,14 @@
 		wh->minor = wh->major = ~0;
 		wh->type = DEV_ALL;
 		wh->access = ACC_MASK;
+		dev_cgroup->deny_all = false;
 		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->deny_all = parent_dev_cgroup->deny_all;
 		mutex_unlock(&devcgroup_mutex);
 		if (ret) {
 			kfree(dev_cgroup);
@@ -409,9 +412,11 @@
 	case DEVCG_ALLOW:
 		if (!parent_has_perm(devcgroup, &wh))
 			return -EPERM;
+		devcgroup->deny_all = false;
 		return dev_whitelist_add(devcgroup, &wh);
 	case DEVCG_DENY:
 		dev_whitelist_rm(devcgroup, &wh);
+		devcgroup->deny_all = true;
 		break;
 	default:
 		return -EINVAL;

  reply	other threads:[~2012-08-09 19:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-09 19:04 [PATCH RESEND 0/4] device_cgroup: replace internally whitelist with exception list aris-moeOTchvdi7YtjvyW6yDsg
2012-08-09 19:04 ` aris [this message]
2012-08-09 19:04 ` [PATCH RESEND 2/4] device_cgroup: introduce dev_whitelist_clean() aris
2012-08-09 19:04 ` [PATCH RESEND 3/4] device_cgroup: convert device_cgroup internally to policy + exceptions aris-moeOTchvdi7YtjvyW6yDsg
2012-08-09 19:04 ` [PATCH RESEND 4/4] device_cgroup: rename whitelist to exception list aris
     [not found] ` <20120809190414.773462171-+5JutNtNrJPwzbzh4h2Q61C45dnP8DBc@public.gmane.org>
2012-08-16 20:08   ` [PATCH RESEND 0/4] device_cgroup: replace internally whitelist with " Andrew Morton
     [not found]     ` <20120816130844.6f26530d.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2012-08-16 20:49       ` Aristeu Rozanski

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=20120809190415.021701086@muttley.lan.cathedral \
    --to=aris@ruivo.org \
    --cc=cgroups@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=tj@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox