Skip to content

Commit

Permalink
[PATCH] SELinux: add security_task_movememory calls to mm code
Browse files Browse the repository at this point in the history
This patch inserts security_task_movememory hook calls into memory management
code to enable security modules to mediate this operation between tasks.

Since the last posting, the hook has been renamed following feedback from
Christoph Lameter.

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>
Cc: Andi Kleen <ak@muc.de>
Acked-by: Christoph Lameter <clameter@sgi.com>
Acked-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
David Quigley authored and Linus Torvalds committed Jun 23, 2006
1 parent 3560154 commit 86c3a76
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mm/mempolicy.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
#include <linux/proc_fs.h>
#include <linux/migrate.h>
#include <linux/rmap.h>
#include <linux/security.h>

#include <asm/tlbflush.h>
#include <asm/uaccess.h>
Expand Down Expand Up @@ -942,6 +943,10 @@ asmlinkage long sys_migrate_pages(pid_t pid, unsigned long maxnode,
goto out;
}

err = security_task_movememory(task);
if (err)
goto out;

err = do_migrate_pages(mm, &old, &new,
capable(CAP_SYS_NICE) ? MPOL_MF_MOVE_ALL : MPOL_MF_MOVE);
out:
Expand Down
6 changes: 6 additions & 0 deletions mm/migrate.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <linux/writeback.h>
#include <linux/mempolicy.h>
#include <linux/vmalloc.h>
#include <linux/security.h>

#include "internal.h"

Expand Down Expand Up @@ -905,6 +906,11 @@ asmlinkage long sys_move_pages(pid_t pid, unsigned long nr_pages,
goto out2;
}

err = security_task_movememory(task);
if (err)
goto out2;


task_nodes = cpuset_mems_allowed(task);

/* Limit nr_pages so that the multiplication may not overflow */
Expand Down

0 comments on commit 86c3a76

Please sign in to comment.