From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Fri, 21 Oct 2005 09:33:20 -0700 (PDT) From: Christoph Lameter Subject: Re: [PATCH 4/4] Swap migration V3: sys_migrate_pages interface In-Reply-To: <200510211118.10886.raybry@mpdtxmail.amd.com> Message-ID: References: <20051020225935.19761.57434.sendpatchset@schroedinger.engr.sgi.com> <20051021081553.50716b97.pj@sgi.com> <200510211118.10886.raybry@mpdtxmail.amd.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-linux-mm@kvack.org Return-Path: To: Ray Bryant Cc: Paul Jackson , KAMEZAWA Hiroyuki , Simon.Derr@bull.net, akpm@osdl.org, kravetz@us.ibm.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, magnus.damm@gmail.com, marcelo.tosatti@cyclades.com List-ID: On Fri, 21 Oct 2005, Ray Bryant wrote: > That code used to be there. Basically the check was that if you could > legally send a signal to the process, you could migrate its memory. > Go back and look and my patches for this. > > Why was this dropped, arbitrarily? Sorry, it was separated out from the sys_migrate patch. Here is the fix: Index: linux-2.6.14-rc4-mm1/mm/mempolicy.c =================================================================== --- linux-2.6.14-rc4-mm1.orig/mm/mempolicy.c 2005-10-20 14:45:45.000000000 -0700 +++ linux-2.6.14-rc4-mm1/mm/mempolicy.c 2005-10-21 09:32:19.000000000 -0700 @@ -784,12 +784,26 @@ asmlinkage long sys_migrate_pages(pid_t if (!mm) return -EINVAL; + /* + * Permissions check like for signals. + * See check_kill_permission() + */ + 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; + } + /* Is the user allowed to access the target nodes? */ - if (!nodes_subset(new, cpuset_mems_allowed(task))) - return -EPERM; + if (!nodes_subset(new, cpuset_mems_allowed(task)) && + !capable(CAP_SYS_ADMIN)) { + err= -EPERM; + goto out; + } err = do_migrate_pages(mm, &old, &new, MPOL_MF_MOVE); - +out: mmput(mm); return err; } -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org