aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-03-12 18:48:24 -0400
committerEric W. Biederman <ebiederm@xmission.com>2012-05-15 17:59:30 -0400
commitb38a86eb196d9402299919456fe3f28e490c76fa (patch)
tree7e5527ceb26989c48342ab1660de117ccd159279
parent14a590c3f987977d7b09ec926481ee0238c08eee (diff)
userns: Convert the move_pages, and migrate_pages permission checks to use uid_eq
Acked-by: Serge Hallyn <serge.hallyn@canonical.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
-rw-r--r--init/Kconfig2
-rw-r--r--mm/mempolicy.c4
-rw-r--r--mm/migrate.c4
3 files changed, 4 insertions, 6 deletions
diff --git a/init/Kconfig b/init/Kconfig
index d24cc75caf65..b5dff4d1e1de 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -865,8 +865,6 @@ config UIDGID_CONVERTED
865 865
866 # List of kernel pieces that need user namespace work 866 # List of kernel pieces that need user namespace work
867 # Features 867 # Features
868 depends on MIGRATION = n
869 depends on NUMA = n
870 depends on SYSVIPC = n 868 depends on SYSVIPC = n
871 depends on IMA = n 869 depends on IMA = n
872 depends on EVM = n 870 depends on EVM = n
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index cfb6c8678754..7b44fc8ec99c 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1334,8 +1334,8 @@ SYSCALL_DEFINE4(migrate_pages, pid_t, pid, unsigned long, maxnode,
1334 * userid as the target process. 1334 * userid as the target process.
1335 */ 1335 */
1336 tcred = __task_cred(task); 1336 tcred = __task_cred(task);
1337 if (cred->euid != tcred->suid && cred->euid != tcred->uid && 1337 if (!uid_eq(cred->euid, tcred->suid) && !uid_eq(cred->euid, tcred->uid) &&
1338 cred->uid != tcred->suid && cred->uid != tcred->uid && 1338 !uid_eq(cred->uid, tcred->suid) && !uid_eq(cred->uid, tcred->uid) &&
1339 !capable(CAP_SYS_NICE)) { 1339 !capable(CAP_SYS_NICE)) {
1340 rcu_read_unlock(); 1340 rcu_read_unlock();
1341 err = -EPERM; 1341 err = -EPERM;
diff --git a/mm/migrate.c b/mm/migrate.c
index 51c08a0c6f68..1cf5252c3b99 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -1371,8 +1371,8 @@ SYSCALL_DEFINE6(move_pages, pid_t, pid, unsigned long, nr_pages,
1371 * userid as the target process. 1371 * userid as the target process.
1372 */ 1372 */
1373 tcred = __task_cred(task); 1373 tcred = __task_cred(task);
1374 if (cred->euid != tcred->suid && cred->euid != tcred->uid && 1374 if (!uid_eq(cred->euid, tcred->suid) && !uid_eq(cred->euid, tcred->uid) &&
1375 cred->uid != tcred->suid && cred->uid != tcred->uid && 1375 !uid_eq(cred->uid, tcred->suid) && !uid_eq(cred->uid, tcred->uid) &&
1376 !capable(CAP_SYS_NICE)) { 1376 !capable(CAP_SYS_NICE)) {
1377 rcu_read_unlock(); 1377 rcu_read_unlock();
1378 err = -EPERM; 1378 err = -EPERM;