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>,
	Lukasz Trabinski <lukasz@wsisiz.edu.pl>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: uselib()  & 2.6.X?
Date: Sun, 9 Jan 2005 09:06:30 -0200	[thread overview]
Message-ID: <20050109110630.GA9144@logos.cnet> (raw)
In-Reply-To: <Pine.LNX.4.58.0501081734400.2339@ppc970.osdl.org>

On Sat, Jan 08, 2005 at 05:38:50PM -0800, Linus Torvalds wrote:
> 
> On Sat, 8 Jan 2005, Marcelo Tosatti wrote:
> >
> > > No, I'd just fix them up.
> > 
> > What do you mean by "fix them up" ? With your minimal fix the other do_brk() callers 
> > do not have the lock, you dont mean "fix" by grabbing the lock? 
> 
> I'm saying that if we decide to do the debugging warning (and I think 
> everybody is agreeing that we should), then we _will_ fix it by just 
> grabbing the lock in all the paths. That's what we already did with 
> do_mmap(), after all.

OK - you dont like the idea of having a wrapper to grab the lock and use that ?

> I suspect it's not strictly needed, but as Alan has said, even though 
> nothing else can chaneg the vma's at the same time, it's the right thing 
> to do to keep /proc reads happy (which _can_ happen) anyway. And more 
> importantly, invariants are nice - to the point where it's good to follow 
> the rules even if it might not be strictly necessary.

I agree. The chance of getting this wrong in the future is smaller if we use the
the "do_brk requires mmap_sem" rule.

> I just wanted to keep these two issues separate. I think it's one thing to 
> fix a known bug, and another thing to add some debug infrastructure to 
> make sure that it doesn't happen in the future. So I think the WARN_ON() + 
> adding of extra locking is a separate stage from fixing the known problem.

OK - I think v2.4 being consistent wrt function names and calling convetion in 
this area is important. 

If you don't like the wrapper I'll change all callers do grab the lock accordingly.

And have this warning as you suggested (which makes a hell lot more sense): 

--- mm/mmap.c.orig      2005-01-07 09:14:01.000000000 -0200
+++ mm/mmap.c 2005-01-09 08:56:55.521436072 -0200
@@ -1061,6 +1061,13 @@
        }
 
        /*
+        * mm->mmap_sem is required to protect against another thread
+        * changing the mappings while we sleep (on kmalloc for one).
+        */
+       if (down_read_trylock(&mm->mmap_sem))
+               BUG();
+
+       /*
         * Clear old maps.  this also does some error checking for us
         */
  munmap_back:


  reply	other threads:[~2005-01-09 13:59 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-07 15:59 uselib() & 2.6.X? Lukasz Trabinski
2005-01-07 17:07 ` Marcelo Tosatti
2005-01-07 20:27   ` linux-os
2005-01-07 22:29     ` Athanasius
2005-01-07 22:49   ` Alan Cox
2005-01-08  0:15     ` Linus Torvalds
2005-01-07 22:12       ` Marcelo Tosatti
2005-01-08 18:46         ` Linus Torvalds
2005-01-08 18:28           ` Marcelo Tosatti
2005-01-09  1:38             ` Linus Torvalds
2005-01-09 11:06               ` Marcelo Tosatti [this message]
2005-01-10  8:34                 ` Frank Steiner
2005-01-10 16:51                   ` Marcelo Tosatti
2005-01-10 18:28                   ` Alan Cox
2005-01-11  7:49                     ` Frank Steiner
2005-01-08 21:07           ` Andreas Schwab
2005-01-08 22:30             ` Barry K. Nathan
2005-01-08 23:21             ` Andi Kleen
2005-01-08 23:30               ` Alan Cox
2005-01-09  0:57                 ` Andi Kleen
2005-01-09  0:49             ` Andries Brouwer
2005-01-09  2:21               ` Jesper Juhl
2005-01-09  2:17                 ` Andries Brouwer
2005-01-08 21:47           ` Alan Cox
2005-01-11 22:51           ` [PATCH] make uselib configurable (was Re: uselib() & 2.6.X?) Barry K. Nathan
2005-01-11 23:42             ` Jesper Juhl
2005-01-11 23:59             ` Andries Brouwer
2005-01-12  1:06               ` Jesper Juhl
2005-01-12  1:18                 ` David Lang
2005-01-11 22:36                   ` Marcelo Tosatti
2005-01-12  2:32                     ` Barry K. Nathan
2005-01-12  0:56                       ` Marcelo Tosatti
2005-01-12  6:10                         ` Barry K. Nathan
2005-01-12 16:47                           ` Adrian Bunk
2005-01-12 17:10                             ` Barry K. Nathan
2005-01-12 20:16                     ` Matt Mackall
2005-01-12  2:12               ` Barry K. Nathan
2005-01-12  2:23                 ` David Lang
2005-01-12  2:30                 ` Adrian Bunk
2005-01-12  5:11                 ` Stephen Pollei
2005-01-12 16:54                   ` Adrian Bunk
2005-01-12  7:58               ` Christoph Hellwig

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=20050109110630.GA9144@logos.cnet \
    --to=marcelo.tosatti@cyclades.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukasz@wsisiz.edu.pl \
    --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).