This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 0/2] Share code to disable ASR between GDB and gdbserver


Hi,

This patch series shares code to disable ASR (address space
randomization) between GDB and gdbserver.  Specifically, it shares
parts of the code of the following functions:

  - gdb/linux-nat.c:linux_nat_create_inferior
  - gdb/gdbserver/linux-low.c:linux_create_inferior

It creates a new file under nat/, named linux-personality.c.  This new
file contains some functions that disable ASR before the inferior is
created, and then create a cleanup that can be called at the end of
the *_create_inferior function to re-enable ASR.  This idea was
proposed by Gary, and it is possible because gdbserver now can make
use of exceptions and cleanups (thanks, Gary!).

Before being able to share this code, I had to struggle with
safe_strerror: the GDB code to disable ASR calls this function to
report an error, but gdbserver calls only strerror.  So, after some
time, I managed to share safe_strerror between both; the code now
lives in common/, and obeys the original separation between POSIX and
MingW systems.  Pedro pointed out that we could import the strerror
module from gnulib, which already addresses the same issues that our
safe_strerror does, and does a bit more.  However, this has already
been tried before (by Tom Tromey), and the result was not good.  For
more details, please read this thread:
<https://lists.gnu.org/archive/html/bug-gnulib/2013-11/msg00078.html>.
In the end, I decided to share safe_strerror between both GDB and
gdbserver.

I regtested this patch on Fedora 20 x86_64, and found no regressions.
I intend to check the patches separately in the tree.

OK to check in?

Sergio.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]