diff options
author | Christoph Lameter <clameter@sgi.com> | 2006-03-14 22:50:21 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-15 00:43:02 -0500 |
commit | 74c002410548c7cb1744b45d17a5fa21da515b63 (patch) | |
tree | d83774ce92907ecaf450998ddaf865836fde00ea | |
parent | b4fb376628e63bfc8071fc915b921da3db4a3385 (diff) |
[PATCH] Consistent capabilites associated with MPOL_MOVE_ALL
It seems that setting scheduling policy and priorities is also the kind of
thing that might be performed in apps that also use the NUMA API, so it
would seem consistent to use CAP_SYS_NICE for NUMA also.
So use CAP_SYS_NICE for controlling migration permissions.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Cc: Michael Kerrisk <mtk-manpages@gmx.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | mm/mempolicy.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 954981b14303..2a8206009422 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c | |||
@@ -748,7 +748,7 @@ long do_mbind(unsigned long start, unsigned long len, | |||
748 | MPOL_MF_MOVE | MPOL_MF_MOVE_ALL)) | 748 | MPOL_MF_MOVE | MPOL_MF_MOVE_ALL)) |
749 | || mode > MPOL_MAX) | 749 | || mode > MPOL_MAX) |
750 | return -EINVAL; | 750 | return -EINVAL; |
751 | if ((flags & MPOL_MF_MOVE_ALL) && !capable(CAP_SYS_RESOURCE)) | 751 | if ((flags & MPOL_MF_MOVE_ALL) && !capable(CAP_SYS_NICE)) |
752 | return -EPERM; | 752 | return -EPERM; |
753 | 753 | ||
754 | if (start & ~PAGE_MASK) | 754 | if (start & ~PAGE_MASK) |
@@ -942,20 +942,20 @@ asmlinkage long sys_migrate_pages(pid_t pid, unsigned long maxnode, | |||
942 | */ | 942 | */ |
943 | if ((current->euid != task->suid) && (current->euid != task->uid) && | 943 | if ((current->euid != task->suid) && (current->euid != task->uid) && |
944 | (current->uid != task->suid) && (current->uid != task->uid) && | 944 | (current->uid != task->suid) && (current->uid != task->uid) && |
945 | !capable(CAP_SYS_ADMIN)) { | 945 | !capable(CAP_SYS_NICE)) { |
946 | err = -EPERM; | 946 | err = -EPERM; |
947 | goto out; | 947 | goto out; |
948 | } | 948 | } |
949 | 949 | ||
950 | task_nodes = cpuset_mems_allowed(task); | 950 | task_nodes = cpuset_mems_allowed(task); |
951 | /* Is the user allowed to access the target nodes? */ | 951 | /* Is the user allowed to access the target nodes? */ |
952 | if (!nodes_subset(new, task_nodes) && !capable(CAP_SYS_ADMIN)) { | 952 | if (!nodes_subset(new, task_nodes) && !capable(CAP_SYS_NICE)) { |
953 | err = -EPERM; | 953 | err = -EPERM; |
954 | goto out; | 954 | goto out; |
955 | } | 955 | } |
956 | 956 | ||
957 | err = do_migrate_pages(mm, &old, &new, | 957 | err = do_migrate_pages(mm, &old, &new, |
958 | capable(CAP_SYS_ADMIN) ? MPOL_MF_MOVE_ALL : MPOL_MF_MOVE); | 958 | capable(CAP_SYS_NICE) ? MPOL_MF_MOVE_ALL : MPOL_MF_MOVE); |
959 | out: | 959 | out: |
960 | mmput(mm); | 960 | mmput(mm); |
961 | return err; | 961 | return err; |