linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] do_brk() needs mmap_sem write-locked
Date: Wed, 12 Jan 2005 13:27:08 -0200	[thread overview]
Message-ID: <20050112152708.GE32024@logos.cnet> (raw)
In-Reply-To: <Pine.LNX.4.58.0501120800500.2373@ppc970.osdl.org>

On Wed, Jan 12, 2005 at 08:03:44AM -0800, Linus Torvalds wrote:
> 
> 
> Looks good, except for a small nit:
> 
> On Tue, 11 Jan 2005, Marcelo Tosatti wrote:
> > diff -Nur linux-2.6-curr.orig/mm/mmap.c linux-2.6-curr/mm/mmap.c
> > --- linux-2.6-curr.orig/mm/mmap.c	2005-01-11 22:48:49.000000000 -0200
> > +++ linux-2.6-curr/mm/mmap.c	2005-01-11 23:43:10.704800272 -0200
> > @@ -1891,6 +1891,12 @@
> >  	}
> >  
> >  	/*
> > +	 * mm->mmap_sem is required to protect against another thread
> > +	 * changing the mappings in case we sleep.
> > +	 */
> > +	WARN_ON(down_read_trylock(&mm->mmap_sem));
> > +
> > +	/*
> >  	 * Clear old maps.  this also does some error checking for us
> >  	 */
> >   munmap_back:
> > 
> 
> if that warning ever triggers, mmap_sem will now be locked, and that will 
> cause problems. So I suspect it's better to do
> 
> 	if (down_read_trylock(&mm->mmap_sem)) {
> 		WARN_ON(1);
> 		up_read(&mm->mmap_sem);
> 	}
> 
> and move that into a helper function of its own (something like
> "verify_mmap_write_lock_held()").

OK - I've seen you just committed a fix.

I've fixed v2.4 version.

  reply	other threads:[~2005-01-12 18:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-12  0:21 [PATCH] do_brk() needs mmap_sem write-locked Marcelo Tosatti
2005-01-12 16:03 ` Linus Torvalds
2005-01-12 15:27   ` Marcelo Tosatti [this message]
2005-01-13 15:36   ` Alan Cox

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=20050112152708.GE32024@logos.cnet \
    --to=marcelo.tosatti@cyclades.com \
    --cc=akpm@osdl.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).