This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug server/17302] gdbserver function call + detach crashes inferior process
- From: "simon.marchi at ericsson dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Wed, 03 Sep 2014 15:51:23 +0000
- Subject: [Bug server/17302] gdbserver function call + detach crashes inferior process
- Auto-submitted: auto-generated
- References: <bug-17302-4717 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=17302
--- Comment #2 from Simon Marchi <simon.marchi at ericsson dot com> ---
I found that during the manual call to a function by gdbserver, a segmentation
fault/SIGSEGV is generated. When detaching, gdbserver delivers the pending
SIGSEGV, causing the crash of the detached process.
When preparing the inferior call, gdb starts by expanding a stack a bit. It
then places a breakpoint instruction (0xCC) somewhere in that area. It then
prepares the dummy frame, including writing the return address, which is the
address where the 0xCC is. So when the function ends, execution should go where
the breakpoint and it should stop. However, since stack is generally not
executable, when the processor tries to "execute" the breakpoint instruction, a
segmentation fault/SIGSEGV is generated instead of the normal SIGTRAP.
When making the stack executable, the problem disappears, so I am quite
confident that this is the reason. In order to make the stack executable, I use
execstack (it modifies a flag in the binary):
$ execstack -s binary
I have no idea why this only happens in gdbserver, and not in gdb.
--
You are receiving this mail because:
You are on the CC list for the bug.