public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Andi Kleen <ak@suse.de>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fix put_user under mmap_sem in sys_get_mempolicy()
Date: Fri, 21 Jan 2005 16:12:18 +0100	[thread overview]
Message-ID: <20050121151218.GA21389@wotan.suse.de> (raw)
In-Reply-To: <41F12773.AAC62D5C@tv-sign.ru>

On Fri, Jan 21, 2005 at 07:01:55PM +0300, Oleg Nesterov wrote:
> Andi Kleen wrote:
> >
> > I suppose this simpler patch has the same effect (also untested).
> >
> > 	if (flags & ~(unsigned long)(MPOL_F_NODE|MPOL_F_ADDR))
> > 		return -EINVAL;
> >@@ -502,6 +502,10 @@
> > 			pol = vma->vm_ops->get_policy(vma, addr);
> > 		else
> > 			pol = vma->vm_policy;
> >+		pol2 = mpol_copy(pol);
> >+		up_read(&mm->mmap_sem);
> >+		if (IS_ERR(pol2)) 
> >+			return PTR_ERR(pol2);
> >
> 
> I don't think so. With MPOL_F_ADDR|MPOL_F_NODE sys_get_mempolicy
> calls lookup_node()->get_user_pages() few lines below, so we can't
> up_read(&mm->mmap_sem) here.

True.

> 
> > It's hard to figure out what your patch actually does because
> > of all the gratious white space changes.
> 
> For your convenience here is the code with the patch applied.

Looks reasonable. 

-Andi

P.S.: Again if you really care about these class of deadlocks take a look at
tasklist_lock.


      reply	other threads:[~2005-01-21 15:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-21 14:51 [PATCH] fix put_user under mmap_sem in sys_get_mempolicy() Oleg Nesterov
2005-01-21 14:29 ` Andi Kleen
2005-01-21 16:01   ` Oleg Nesterov
2005-01-21 15:12     ` Andi Kleen [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=20050121151218.GA21389@wotan.suse.de \
    --to=ak@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@tv-sign.ru \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox