From: Daniel Jacobowitz <drow@false.org>
To: Mark Kettenis <mark.kettenis@xs4all.nl>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA] s/PIOD_WRITE_D/PIOD_WRITE_I in inf-ptrace.c
Date: Mon, 21 Nov 2005 04:41:00 -0000 [thread overview]
Message-ID: <20051120160847.GA26558@nevyn.them.org> (raw)
In-Reply-To: <200511201312.jAKDCe8r008006@elgar.sibelius.xs4all.nl>
On Sun, Nov 20, 2005 at 02:12:40PM +0100, Mark Kettenis wrote:
> The motivation for the change in OpenBSD is very much related to an
> issue we had when using gdb to debug a nasty X problem. The new
> malloc(3) in OpenBSD 3.8 is pretty aggressive in inserting "guard
> pages" before and after allocated memory to catch buffer overflows.
> The guard pages actually do exists in the page map but have read,
> write and execute permission removed from them. At one point we were
> tracking a problem in X where some code in X was accessing memory
> beyond the allocated area, i.e. in the guard page. The program would
> segfault upon accessing that guard page, but when running in gdb, it
> would appear if nothing was wrong. Examining the memory (using "x" or
> "print") in gdb happily returned the contents of the guard page
> because ptrace(2) was temporarily lifting the page protections.
>
> I'm still thinking about what needs to be changed in gdb to make
> things work properly. Somehow we must differentiate between access to
> I-space and access to D-space. But at least OpenBSD now provides the
> low-level support to do that. Meanwhile, this patch will do as a
> stopgap.
Is this really the right way to solve the problem of GDB ignoring
protections? Don't you have a way for the debugger to query the
inferior's memory map in *BSD? Then it can do all the permission
checks that it wants to, including things like "this instruction is
faulting because the page is rw- instead of r-x".
The bypass-permissions and dont-bypass-permissions variants may be
useful to somewhat simpler programs anyway.
> I'd really like to see this change in GDB 6.4, because otherwise it
> will not work at all on OpenBSD 3.9. But since the release of OpenBSD
> 3.9 is still months ahead, having a GDB 6.4.1 with this issue fixed
> would be fine for me too.
I have no objection to putting this in 6.4.
--
Daniel Jacobowitz
CodeSourcery, LLC
next prev parent reply other threads:[~2005-11-20 16:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-20 21:22 Mark Kettenis
2005-11-21 4:41 ` Daniel Jacobowitz [this message]
2005-11-21 16:35 ` Joel Brobecker
2005-11-21 19:13 ` Mark Kettenis
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=20051120160847.GA26558@nevyn.them.org \
--to=drow@false.org \
--cc=gdb-patches@sourceware.org \
--cc=mark.kettenis@xs4all.nl \
/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