From: Daniel Jacobowitz <dan@debian.org>
To: Andrea Arcangeli <andrea@suse.de>
Cc: Linus Torvalds <torvalds@osdl.org>,
Hugh Dickins <hugh@veritas.com>, Nick Piggin <npiggin@novell.com>,
linux-kernel@vger.kernel.org, Andrew Morton <akpm@osdl.org>,
Roland McGrath <roland@redhat.com>
Subject: Re: ptrace can't be transparent on readonly MAP_SHARED
Date: Thu, 15 Sep 2005 17:09:31 -0400 [thread overview]
Message-ID: <20050915210931.GA14521@nevyn.them.org> (raw)
In-Reply-To: <20050915180928.GI4122@opteron.random>
On Thu, Sep 15, 2005 at 08:09:28PM +0200, Andrea Arcangeli wrote:
> On Thu, Sep 15, 2005 at 10:52:14AM -0700, Linus Torvalds wrote:
> > And the PTRACE_POKE is _exactly_ the same thing. There's _zero_
> > difference. The fact that PTRACE_POKE _changes_ the data instead of just
> > reading it doesn't change anything at all - the fact that data got changed
> > in NO WAY invalidates the fact that processes might still depend on
> > getting a SIGSEGV.
>
> And this process may as well depend to see the on-disk changes that
> other threads are doing on the shared memory, and that will break
> regardless of what Linus changes in the kernel.
>
> You also didn't make up any useful example where _writing_ (not reading
> like in your example) was involved. Your example is totally offtopic,
> since it only involved reading as far as I can tell.
>
> I can't imagine where writing to a PROT_NONE is actually useful.
Well, you won't like this example any better, then, but this was a
frequently reported GDB bug for a while:
const int x;
int main()
{
*x = 1;
return 0;
}
x goes in rodata -> text segment -> on the same page as main. If you
run to main in GDB, the page becomes writable. The store doesn't
crash. If you run it out of GDB, it crashes.
Sure, the trivial example's uninteresting. But you can construct a
larger example with, say, *foo() = x replaced by *foo = x. That's not
legal in C for a function foo, of course. But you could probably
manage it in some other language, or in asm. So you debug right around
where you're getting a crash in your application, and it doesn't crash.
Ptrace needs to be as unintrusive as possible. Having the page COW
unexpectedly is a lot less bad than having it COW _and_ remain
writable.
--
Daniel Jacobowitz
CodeSourcery, LLC
next prev parent reply other threads:[~2005-09-15 21:09 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-14 21:24 ptrace can't be transparent on readonly MAP_SHARED Andrea Arcangeli
2005-09-15 4:05 ` Nick Piggin
2005-09-15 13:18 ` Hugh Dickins
2005-09-15 15:12 ` Linus Torvalds
2005-09-15 15:47 ` Andrea Arcangeli
2005-09-15 16:13 ` Linus Torvalds
2005-09-15 16:23 ` Andrea Arcangeli
2005-09-15 16:34 ` Linus Torvalds
2005-09-15 16:51 ` Andrea Arcangeli
2005-09-15 17:52 ` Linus Torvalds
2005-09-15 18:09 ` Andrea Arcangeli
2005-09-15 21:09 ` Daniel Jacobowitz [this message]
2005-09-15 21:58 ` Andrea Arcangeli
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=20050915210931.GA14521@nevyn.them.org \
--to=dan@debian.org \
--cc=akpm@osdl.org \
--cc=andrea@suse.de \
--cc=hugh@veritas.com \
--cc=linux-kernel@vger.kernel.org \
--cc=npiggin@novell.com \
--cc=roland@redhat.com \
--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