All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Larry Finger <Larry.Finger@lwfinger.net>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: Question about do_mmap changes
Date: Mon, 4 Jun 2012 08:27:55 +0100	[thread overview]
Message-ID: <20120604072755.GY30000@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20120604065638.GW30000@ZenIV.linux.org.uk>

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 ;-/

      reply	other threads:[~2012-06-04  7:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-04  5:29 Question about do_mmap changes Larry Finger
2012-06-04  6:26 ` Al Viro
2012-06-04  6:37   ` Larry Finger
2012-06-04  6:56     ` Al Viro
2012-06-04  7:27       ` Al Viro [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120604072755.GY30000@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=Larry.Finger@lwfinger.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.