From: David Quigley Date: Wed, 28 Jun 2006 13:36:46 +0000 (-0400) Subject: [MIPS] SELinux: Add security hooks to mips-mt {get,set}affinity X-Git-Tag: v2.6.21-rc2~42^2~24^2~12 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=7418cb89af6f9e21660d60a4bd088a8b6fd11e81;p=~emulex%2Finfiniband.git [MIPS] SELinux: Add security hooks to mips-mt {get,set}affinity This patch adds LSM hooks into the setaffinity and getaffinity functions for the mips architecture to enable security modules to control these operations between tasks with different security attributes. This implementation uses the existing task_setscheduler and task_getscheduler LSM hooks. Signed-Off-By: David Quigley Acked-by: Stephen Smalley Signed-off-by: James Morris Signed-off-by: Ralf Baechle --- diff --git a/arch/mips/kernel/mips-mt.c b/arch/mips/kernel/mips-mt.c index c1373a6e668..a32f6797353 100644 --- a/arch/mips/kernel/mips-mt.c +++ b/arch/mips/kernel/mips-mt.c @@ -96,6 +96,10 @@ asmlinkage long mipsmt_sys_sched_setaffinity(pid_t pid, unsigned int len, goto out_unlock; } + retval = security_task_setscheduler(p, 0, NULL); + if (retval) + goto out_unlock; + /* Record new user-specified CPU set for future reference */ p->thread.user_cpus_allowed = new_mask; @@ -141,8 +145,9 @@ asmlinkage long mipsmt_sys_sched_getaffinity(pid_t pid, unsigned int len, p = find_process_by_pid(pid); if (!p) goto out_unlock; - - retval = 0; + retval = security_task_getscheduler(p); + if (retval) + goto out_unlock; cpus_and(mask, p->thread.user_cpus_allowed, cpu_possible_map);