[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LFD.2.00.1005131516300.3711@i5.linux-foundation.org>
Date: Thu, 13 May 2010 15:25:01 -0700 (PDT)
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Andi Kleen <andi@...stfloor.org>
cc: Oleg Nesterov <oleg@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Srikar Dronamraju <srikar@...ux.vnet.ibm.com>,
Ingo Molnar <mingo@...e.hu>,
Andrew Morton <akpm@...ux-foundation.org>,
Masami Hiramatsu <mhiramat@...hat.com>,
Randy Dunlap <rdunlap@...otime.net>,
Ananth N Mavinakayanahalli <ananth@...ibm.com>,
Jim Keniston <jkenisto@...ux.vnet.ibm.com>,
Frederic Weisbecker <fweisbec@...il.com>,
"Frank Ch. Eigler" <fche@...hat.com>,
LKML <linux-kernel@...r.kernel.org>,
Roland McGrath <roland@...hat.com>, Mel Gorman <mel@....ul.ie>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Andrea Arcangeli <aarcange@...hat.com>,
Hugh Dickins <hugh.dickins@...cali.co.uk>,
Rik van Riel <riel@...hat.com>
Subject: Re: [PATCH v2 7/11] Uprobes Implementation
On Fri, 14 May 2010, Andi Kleen wrote:
>
> But isn't text usually shared? I don't see how you could set any
> break points or jump probes on text pages with that restriction.
Text is usually private, and read-only. Not generally MAP_SHARED. The
pages end up getting shared because nobody writes to them, but that's
almost accidental.
If you write to them, you get a nice clean COW fault, and you are
_supposed_ to get a nice clean COW fault. It's not changing any semantics:
the write is not visible to outside users, and those "get a private page"
semantics were what the mmap() was all about.
In contrast, if it's a MAP_SHARED mapping and writable, the write would
actually be _visible_ outside the process. And that's clearly totally
wrong on all levels. Tracing a process should _never_ cause visible damage
outside that process (you'd hope it wouldn't be all that visibel to the
tracee either, but that's still secondary).
The alternative, ie a MAP_SHARED but read-only mapping (which looks very
much like a private mapping) if you use get_user_pages(.force=1), the
kernel will actually end up forcing a COW break, because making the write
visible outside would be a security issue (you don't even have the right
to write to the thing).
Notice how the MAP_SHARED case - writable or not - ends up doing the wrong
thing. Arguably it does the _even_worse_ thing in the writable case, but
in either case it's not good.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists