Skip to content

Commit

Permalink
[MIPS] SELinux: Add security hooks to mips-mt {get,set}affinity
Browse files Browse the repository at this point in the history
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 <dpquigl@tycho.nsa.gov>
Acked-by:  Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: James Morris <jmorris@namei.org>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  • Loading branch information
David Quigley authored and Ralf Baechle committed Feb 6, 2007
1 parent c917061 commit 7418cb8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions arch/mips/kernel/mips-mt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 7418cb8

Please sign in to comment.