Messages in this thread | | | Date | Mon, 4 Jun 2012 08:27:55 +0100 | From | Al Viro <> | Subject | Re: Question about do_mmap changes |
| |
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 ;-/
| |