diff options
author | David Quigley <dpquigl@tycho.nsa.gov> | 2006-06-23 05:04:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-23 10:42:54 -0400 |
commit | 22fb52dd736a62e24c44c50739007496265dc38c (patch) | |
tree | 06cc6dcff21df6e18f189c6895cf6aa313e7a8ea /kernel/cpuset.c | |
parent | e7834f8fccd791225a1cf91c2c3e740ad8e2e145 (diff) |
[PATCH] SELinux: add security hook call to mediate attach_task (kernel/cpuset.c)
Add a security hook call to enable security modules to control the ability
to attach a task to a cpuset. While limited control over this operation is
possible via permission checks on the pseudo fs interface, those checks are
not sufficient to control access to the target task, which is looked up in
this function. The existing task_setscheduler hook is re-used for this
operation since this falls under the same class of operations.
Signed-off-by: David Quigley <dpquigl@tycho.nsa.gov>
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: James Morris <jmorris@namei.org>
Acked-by: Paul Jackson <pj@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/cpuset.c')
-rw-r--r-- | kernel/cpuset.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 77f45ffd5ea1..b602f73fb38d 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/rcupdate.h> | 41 | #include <linux/rcupdate.h> |
42 | #include <linux/sched.h> | 42 | #include <linux/sched.h> |
43 | #include <linux/seq_file.h> | 43 | #include <linux/seq_file.h> |
44 | #include <linux/security.h> | ||
44 | #include <linux/slab.h> | 45 | #include <linux/slab.h> |
45 | #include <linux/smp_lock.h> | 46 | #include <linux/smp_lock.h> |
46 | #include <linux/spinlock.h> | 47 | #include <linux/spinlock.h> |
@@ -1177,6 +1178,7 @@ static int attach_task(struct cpuset *cs, char *pidbuf, char **ppathbuf) | |||
1177 | cpumask_t cpus; | 1178 | cpumask_t cpus; |
1178 | nodemask_t from, to; | 1179 | nodemask_t from, to; |
1179 | struct mm_struct *mm; | 1180 | struct mm_struct *mm; |
1181 | int retval; | ||
1180 | 1182 | ||
1181 | if (sscanf(pidbuf, "%d", &pid) != 1) | 1183 | if (sscanf(pidbuf, "%d", &pid) != 1) |
1182 | return -EIO; | 1184 | return -EIO; |
@@ -1205,6 +1207,12 @@ static int attach_task(struct cpuset *cs, char *pidbuf, char **ppathbuf) | |||
1205 | get_task_struct(tsk); | 1207 | get_task_struct(tsk); |
1206 | } | 1208 | } |
1207 | 1209 | ||
1210 | retval = security_task_setscheduler(tsk, 0, NULL); | ||
1211 | if (retval) { | ||
1212 | put_task_struct(tsk); | ||
1213 | return retval; | ||
1214 | } | ||
1215 | |||
1208 | mutex_lock(&callback_mutex); | 1216 | mutex_lock(&callback_mutex); |
1209 | 1217 | ||
1210 | task_lock(tsk); | 1218 | task_lock(tsk); |