diff options
author | David Quigley <dpquigl@tycho.nsa.gov> | 2006-06-23 02:03:59 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-23 07:42:53 -0700 |
commit | e7834f8fccd791225a1cf91c2c3e740ad8e2e145 (patch) | |
tree | 8f48d03d7b1dc32d326825fef1d1c54117a06ac8 /kernel/sched.c | |
parent | 03e68060636e05989ea94bcb671ab633948f328c (diff) | |
download | kernel_samsung_espresso10-e7834f8fccd791225a1cf91c2c3e740ad8e2e145.zip kernel_samsung_espresso10-e7834f8fccd791225a1cf91c2c3e740ad8e2e145.tar.gz kernel_samsung_espresso10-e7834f8fccd791225a1cf91c2c3e740ad8e2e145.tar.bz2 |
[PATCH] SELinux: add security hooks to {get,set}affinity
This patch adds LSM hooks into the setaffinity and getaffinity functions to
enable security modules to control these operations between tasks with
task_setscheduler and task_getscheduler LSM hooks.
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>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r-- | kernel/sched.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index c13f1bd..8766513 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -3886,6 +3886,10 @@ long sched_setaffinity(pid_t pid, cpumask_t new_mask) !capable(CAP_SYS_NICE)) goto out_unlock; + retval = security_task_setscheduler(p, 0, NULL); + if (retval) + goto out_unlock; + cpus_allowed = cpuset_cpus_allowed(p); cpus_and(new_mask, new_mask, cpus_allowed); retval = set_cpus_allowed(p, new_mask); @@ -3954,7 +3958,10 @@ long sched_getaffinity(pid_t pid, cpumask_t *mask) if (!p) goto out_unlock; - retval = 0; + retval = security_task_getscheduler(p); + if (retval) + goto out_unlock; + cpus_and(*mask, p->cpus_allowed, cpu_online_map); out_unlock: |