Re: memory management issues

Peter Zijlstra <[email protected]>
Newsgroups gmane.linux.ports.hppa
Message-ID <1178462545.2789.1.camel@lappy>
On Sun, 2007-05-06 at 09:23 -0500, James Bottomley wrote:
> On Thu, 2007-05-03 at 01:11 -0700, Ollie Wild wrote:
> > Is this a bug in get_user_pages()?  Should it be calling
> > flush_cache_page() directly?
> 
> Just for the sake of completeness, the answer to this is "no".  The
> anonymous page part of get_user_pages() is designed to gather pages from
> current processes only (an then, the only in-tree user we have is fuse
> and that's a bit of a hack).  The problem with your patch is that you're
> trying to gather non-current pages.
> 
> It took me a while to discover this, largely because you do this:
> 
> +                               ret = get_user_pages(current, bprm->mm, pos,
> +                                                    1, 1, 1, &page, NULL);
> 
> That's horribly wrong ... you can't use the current process context to
> gather non-current pages ... if anything goes wrong and the page needs
> faulting (unusual for a nascent process, but not impossible) you'll get
> into terrible trouble because the mapping for the page isn't in current.

Right, what would be the proper way to go about this, a NULL tsk?
Because the bprm->mm is un-owned at this point in time. That is, there
is no process context associated with it at all.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.