Change the permission check to use comparisons instead of XORs. Revise the comments. Signed-off-by: Christoph Lameter Index: linux-2.6.14-mm2/mm/mempolicy.c =================================================================== --- linux-2.6.14-mm2.orig/mm/mempolicy.c 2005-11-12 09:07:32.000000000 -0800 +++ linux-2.6.14-mm2/mm/mempolicy.c 2005-11-12 09:07:37.000000000 -0800 @@ -792,18 +792,13 @@ asmlinkage long sys_migrate_pages(pid_t return -EINVAL; /* - * We only allow a process to move the pages of another - * if the process issuing sys_migrate has the right to send a kill - * signal to the process to be moved. Moving another processes - * memory may impact the performance of that process. If the - * process issuing sys_migrate_pages has the right to kill the - * target process then obviously that process has the right to - * impact the performance of the target process. - * - * The permission check was taken from check_kill_permission() + * Check if this process has the right to modify the specified + * process. The right exists if the process has administrative + * capabilities, superuser priviledges or the same + * userid as the target process. */ - if ((current->euid ^ task->suid) && (current->euid ^ task->uid) && - (current->uid ^ task->suid) && (current->uid ^ task->uid) && + if ((current->euid != task->suid) && (current->euid != task->uid) && + (current->uid != task->suid) && (current->uid != task->uid) && !capable(CAP_SYS_ADMIN)) { err = -EPERM; goto out;