lkml.org 
[lkml]   [2011]   [Mar]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 0/6] enable writing to /proc/pid/mem
On Wed, Mar 09, 2011 at 01:30:17AM +0000, Al Viro wrote:
> On Tue, Mar 08, 2011 at 07:42:17PM -0500, Stephen Wilson wrote:
> > This patch series enables safe writes to /proc/pid/mem. The principle strategy
> > is to get a reference to the target task's mm before the permission check, and
> > to hold that reference until after the write completes.
>
> One note: I'd rather prefer approach similar to mm_for_maps(). IOW, instead
> of "check, then get mm, then check _again_ to decide if we are allowed to
> use it", just turn check_mm_permissions() into a function that returns
> you a safe mm or gives you NULL (or, better yet, ERR_PTR(...)). With all
> checks done within that sucker.

OK. That certainly makes a lot of sense. That can easily be added as
an additional patch to the series so that it is perfectly clear as to
what has been changed and how.

I think we could also remove the intermediate copy in both mem_read() and
mem_write() as well, but I think such optimizations could be left for
follow on patches.

> Then mem_read() and mem_write() wouldn't need to recheck anything again
> and the same helper would be usable for other things as well. I mean
> something like this: (*WARNING* - completely untested)

Will work this into the series, test it, etc.


Thanks!


--
steve



\
 
 \ /
  Last update: 2011-03-09 03:17    [W:0.146 / U:0.408 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site