From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19403 invoked by alias); 9 Jan 2015 22:19:13 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 19381 invoked by uid 89); 9 Jan 2015 22:19:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 09 Jan 2015 22:19:10 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t09MJ9ep016167 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Fri, 9 Jan 2015 17:19:09 -0500 Received: from psique.yyz.redhat.com (dhcp-10-15-16-169.yyz.redhat.com [10.15.16.169]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t09MJ9Ps025112; Fri, 9 Jan 2015 17:19:09 -0500 From: Sergio Durigan Junior To: GDB Patches Cc: Pedro Alves , Gary Benson Subject: [PATCH 0/2] Share code to disable ASR between GDB and gdbserver Date: Fri, 09 Jan 2015 22:19:00 -0000 Message-Id: <1420841943-24290-1-git-send-email-sergiodj@redhat.com> X-IsSubscribed: yes X-SW-Source: 2015-01/txt/msg00238.txt.bz2 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: . 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.