public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Sergio Durigan Junior <sergiodj@redhat.com>
To: "Ulrich Weigand" <uweigand@de.ibm.com>
Cc: gdb-patches@sourceware.org (GDB Patches),
	palves@redhat.com (Pedro Alves),
	       gbenson@redhat.com (Gary Benson)
Subject: [PATCH][commit] Fix regression on RHEL-5 systems (was: Re: [PATCH 2/2] Move code to disable ASR to nat/)
Date: Fri, 16 Jan 2015 16:47:00 -0000	[thread overview]
Message-ID: <871tmu8ygd.fsf@redhat.com> (raw)
In-Reply-To: <201501161538.t0GFclYf021559@d03av02.boulder.ibm.com> (Ulrich	Weigand's message of "Fri, 16 Jan 2015 16:38:46 +0100 (CET)")

On Friday, January 16 2015, Ulrich Weigand wrote:

> Sergio Durigan Junior wrote:
>
>> This patch moves the shared code present on
>> gdb/linux-nat.c:linux_nat_create_inferior and
>> gdb/gdbserver/linux-low.c:linux_create_inferior to
>> nat/linux-personality.c.  This code is responsible for disabling
>> address space randomization based on user setting, and using
>> <sys/personality.h> to do that.  I decided to put the prototype of the
>> maybe_disable_address_space_randomization on nat/linux-osdata.h
>> because it seemed the best place to put it.
>
> This breaks building on my RHEL 5 machine:
>
> /home/uweigand/dailybuild/spu-tc-2015-01-15/binutils-gdb-head/binutils-gdb/gdb/nat/linux-personality.c: In function 'maybe_disable_address_space_randomization':
> /home/uweigand/dailybuild/spu-tc-2015-01-15/binutils-gdb-head/binutils-gdb/gdb/nat/linux-personality.c:80: error: 'ADDR_NO_RANDOMIZE' undeclared (first use in this function)
> /home/uweigand/dailybuild/spu-tc-2015-01-15/binutils-gdb-head/binutils-gdb/gdb/nat/linux-personality.c:80: error: (Each undeclared identifier is reported only once
> /home/uweigand/dailybuild/spu-tc-2015-01-15/binutils-gdb-head/binutils-gdb/gdb/nat/linux-personality.c:80: error: for each function it appears in.)

Ops.  Thanks for letting me know, Ulrich.

> It looks like this is because you replaced:
>> -# if !HAVE_DECL_ADDR_NO_RANDOMIZE
> by:
>> +# ifndef HAVE_DECL_ADDR_NO_RANDOMIZE
>
> but config.h on my machine without ADDR_NO_RANDOMIZE contains:
> #define HAVE_DECL_ADDR_NO_RANDOMIZE 0

I took the liberty to go ahead and push the following patch as obvious.
Please let me know if there is anything else needed.

Thanks,

-- 
Sergio
GPG key ID: 0x65FC5E36
Please send encrypted e-mail if possible
http://sergiodj.net/

commit 4c347be60a1c25f78826fbf86d416a278740145b
Author: Sergio Durigan Junior <sergiodj@redhat.com>
Date:   Fri Jan 16 11:42:28 2015 -0500

    Fix nat/linux-personality.c regression on RHEL-5
    
    This commit fixes the regression on RHEL-5 systems introduced by
    nat/linux-personality.c's check of HAVE_DECL_ADDR_NO_RANDOMIZE.
    RHEL-5 systems define HAVE_DECL_ADDR_NO_RANDOMIZE as zero, so we
    cannot use #ifndef; instead this patch uses the "#if !" construction.
    
    The regression was reported by Ulrich Weigand here:
    
      <https://sourceware.org/ml/gdb-patches/2015-01/msg00458.html>
    
    gdb/ChangeLog
    2015-01-16  Sergio Durigan Junior  <sergiodj@redhat.com>
    
    	* nat/linux-personality.c: Replace "#ifndef
    	HAVE_DECL_ADDR_NO_RANDOMIZE" by "#if
    	!HAVE_DECL_ADDR_NO_RANDOMIZE", fixing a regression in RHEL-5
    	systems.

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b7ba1b2..b95abdc 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2015-01-16  Sergio Durigan Junior  <sergiodj@redhat.com>
+
+	* nat/linux-personality.c: Replace "#ifndef
+	HAVE_DECL_ADDR_NO_RANDOMIZE" by "#if
+	!HAVE_DECL_ADDR_NO_RANDOMIZE", fixing a regression in RHEL-5
+	systems.
+
 2015-01-16  Eli Zaretskii  <eliz@gnu.org>
 
 	* tui/tui-win.c (tui_rehighlight_all, tui_set_var_cmd): New
diff --git a/gdb/nat/linux-personality.c b/gdb/nat/linux-personality.c
index f61a2c6..3ea8755 100644
--- a/gdb/nat/linux-personality.c
+++ b/gdb/nat/linux-personality.c
@@ -22,7 +22,7 @@
 
 #ifdef HAVE_PERSONALITY
 # include <sys/personality.h>
-# ifndef HAVE_DECL_ADDR_NO_RANDOMIZE
+# if !HAVE_DECL_ADDR_NO_RANDOMIZE
 #  define ADDR_NO_RANDOMIZE 0x0040000
 # endif /* ! HAVE_DECL_ADDR_NO_RANDOMIZE */
 #endif /* HAVE_PERSONALITY */

  reply	other threads:[~2015-01-16 16:47 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-09 22:19 [PATCH 0/2] Share code to disable ASR between GDB and gdbserver Sergio Durigan Junior
2015-01-09 22:19 ` [PATCH 2/2] Move code to disable ASR to nat/ Sergio Durigan Junior
2015-01-13 17:11   ` Pedro Alves
2015-01-13 20:55     ` Sergio Durigan Junior
2015-01-14 11:32       ` Pedro Alves
2015-01-15  7:06         ` Sergio Durigan Junior
2015-01-16  0:04         ` Sergio Durigan Junior
2015-01-16 15:39   ` Ulrich Weigand
2015-01-16 16:47     ` Sergio Durigan Junior [this message]
2015-01-19 19:16       ` [PATCH][commit] Fix regression on RHEL-5 systems (was: Re: [PATCH 2/2] Move code to disable ASR to nat/) Ulrich Weigand
2015-01-09 22:19 ` [PATCH 1/2] Move safe_strerror to common/ Sergio Durigan Junior
2015-01-13 16:54   ` Pedro Alves
2015-01-13 20:48     ` Sergio Durigan Junior
2015-01-14 11:26       ` Pedro Alves
2015-01-15  7:05         ` Sergio Durigan Junior
2015-01-15  9:02           ` Pedro Alves
2015-01-16  0:04             ` Sergio Durigan Junior

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=871tmu8ygd.fsf@redhat.com \
    --to=sergiodj@redhat.com \
    --cc=gbenson@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=uweigand@de.ibm.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).