Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Al Viro <viro <at> ZenIV.linux.org.uk>
Subject: Re: Question about do_mmap changes
Newsgroups: gmane.linux.kernel
Date: Monday 4th June 2012 07:27:55 UTC (over 4 years ago)
On Mon, Jun 04, 2012 at 07:56:38AM +0100, Al Viro wrote:
> _IF_ this is done not to current->mm, these guys are in for a world of
> hurt, probably going all way back.

	BTW, rtR0MemObjLinuxDoMmap() would really better be done with
pTask == current; it calls do_mmap(), which acts on current->mm and
nowhere in the function does it look at pTask at all.  The caller
has locked pTask->mm->mmap_sem.  And do_mmap() obviously assumes that
current->mm->mmap_sem is held by caller.

	Looking at the callers (both of that an munmap()), it appears
that they get task from
static struct task_struct *rtR0ProcessToLinuxTask(RTR0PROCESS R0Process)
{
    /** @todo fix rtR0ProcessToLinuxTask!! */
    return R0Process == RTR0ProcHandleSelf() ? current : NULL;
}

So it's probably OK, until they follow up on that todo.  BTW, quite a few
callers of that sucker are followed by Assert(pTask != NULL)...

Most of do_munmap() callers are easily converted to vm_munmap(); the only
exception is cleanup after failure in rtR0MemObjNativeMapUser().  May
or may not be convertable to vm_munmap(); depends on whether they really
need ->mmap_sem held over the entire sequence *and* on whether there's
a better solution.  They seem to be trying to shove an array of pages
into VMA they'd just created and lock them there; I might be misreading
and missing details, though - that code is really as pleasant to read
as using warm stale beer to deal with industrial-strength hangover.  The
kind when you end up spitting out a fly or two, if not a cigarette butt...
I'm not up to that right now - it's half past three in the morning here
and I'll have to get up four hours from now ;-/
 
CD: 3ms