public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Restore behavior of disabling address randomization by default on GDBserver
@ 2018-08-22 16:06 Simon Marchi
  2018-08-22 16:14 ` Pedro Alves
  0 siblings, 1 reply; 5+ messages in thread
From: Simon Marchi @ 2018-08-22 16:06 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

Commit

  c12a508 ("Add client_state struct.")

inadvertently changed the default behavior of GDBserver wrt address
randomization.  The old disable_randomization global variable was
initialized to 1, whereas the corresponding field in the client_state
structure is initialized to 0.

This fixes

  make check TESTS="gdb.base/jit-simple.exp" RUNTESTFLAGS="--target_board=native-gdbserver"
  make check TESTS="gdb.base/execl-update-breakpoints.exp" RUNTESTFLAGS="--target_board=native-gdbserver"

Note that the execl-update-breakpoints.exp would only fail on systems
where the toolchain emits position-independent executables by default
(otherwise the main executable position is never randomized, so the
value of disable_randomization didn't matter).

gdb/gdbserver/ChangeLog:

	PR gdb/23374
	PR gdb/23375
	* server.h (struct client_state) <disable_randomization>:
	Initialize to 1.

diff --git a/gdb/gdbserver/server.h b/gdb/gdbserver/server.h index
8e197ee..5e41e2f 100644 --- a/gdb/gdbserver/server.h +++
b/gdb/gdbserver/server.h @@ -176,7 +176,7 @@ struct client_state

   /* Whether we should attempt to disable the operating system's address
      space randomization feature before starting an inferior.  */
-  int disable_randomization = 0;
+  int disable_randomization = 1;

   int pass_signals[GDB_SIGNAL_LAST];
   int program_signals[GDB_SIGNAL_LAST];
---
 gdb/gdbserver/server.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/gdbserver/server.h b/gdb/gdbserver/server.h
index 8e197ee..5e41e2f 100644
--- a/gdb/gdbserver/server.h
+++ b/gdb/gdbserver/server.h
@@ -176,7 +176,7 @@ struct client_state
 
   /* Whether we should attempt to disable the operating system's address
      space randomization feature before starting an inferior.  */
-  int disable_randomization = 0;
+  int disable_randomization = 1;
 
   int pass_signals[GDB_SIGNAL_LAST];
   int program_signals[GDB_SIGNAL_LAST];
-- 
2.7.4

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Restore behavior of disabling address randomization by default on GDBserver
  2018-08-22 16:06 [PATCH] Restore behavior of disabling address randomization by default on GDBserver Simon Marchi
@ 2018-08-22 16:14 ` Pedro Alves
  2018-08-22 17:38   ` Simon Marchi
  0 siblings, 1 reply; 5+ messages in thread
From: Pedro Alves @ 2018-08-22 16:14 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

On 08/22/2018 05:05 PM, Simon Marchi wrote:
> Commit
> 
>   c12a508 ("Add client_state struct.")
> 
> inadvertently changed the default behavior of GDBserver wrt address
> randomization.  The old disable_randomization global variable was
> initialized to 1, whereas the corresponding field in the client_state
> structure is initialized to 0.
> 
> This fixes
> 
>   make check TESTS="gdb.base/jit-simple.exp" RUNTESTFLAGS="--target_board=native-gdbserver"
>   make check TESTS="gdb.base/execl-update-breakpoints.exp" RUNTESTFLAGS="--target_board=native-gdbserver"
> 
> Note that the execl-update-breakpoints.exp would only fail on systems
> where the toolchain emits position-independent executables by default
> (otherwise the main executable position is never randomized, so the
> value of disable_randomization didn't matter).

Thanks for fixing this!

This is OK, but please double-check the patch/commit, since it
seems to include the same hunk twice.  Kind of looks like
the fix diff made it to the commit log?

> 
> gdb/gdbserver/ChangeLog:
> 
> 	PR gdb/23374
> 	PR gdb/23375
> 	* server.h (struct client_state) <disable_randomization>:
> 	Initialize to 1.
> 
> diff --git a/gdb/gdbserver/server.h b/gdb/gdbserver/server.h index
> 8e197ee..5e41e2f 100644 --- a/gdb/gdbserver/server.h +++
> b/gdb/gdbserver/server.h @@ -176,7 +176,7 @@ struct client_state
> 
>    /* Whether we should attempt to disable the operating system's address
>       space randomization feature before starting an inferior.  */
> -  int disable_randomization = 0;
> +  int disable_randomization = 1;
> 
>    int pass_signals[GDB_SIGNAL_LAST];
>    int program_signals[GDB_SIGNAL_LAST];
> ---
>  gdb/gdbserver/server.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/gdb/gdbserver/server.h b/gdb/gdbserver/server.h
> index 8e197ee..5e41e2f 100644
> --- a/gdb/gdbserver/server.h
> +++ b/gdb/gdbserver/server.h
> @@ -176,7 +176,7 @@ struct client_state
>  
>    /* Whether we should attempt to disable the operating system's address
>       space randomization feature before starting an inferior.  */
> -  int disable_randomization = 0;
> +  int disable_randomization = 1;
>  
>    int pass_signals[GDB_SIGNAL_LAST];
>    int program_signals[GDB_SIGNAL_LAST];
> 
Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Restore behavior of disabling address randomization by default on GDBserver
  2018-08-22 16:14 ` Pedro Alves
@ 2018-08-22 17:38   ` Simon Marchi
  2018-08-26  9:51     ` Joel Brobecker
  0 siblings, 1 reply; 5+ messages in thread
From: Simon Marchi @ 2018-08-22 17:38 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Simon Marchi, gdb-patches

On 2018-08-22 12:14, Pedro Alves wrote:
> On 08/22/2018 05:05 PM, Simon Marchi wrote:
>> Commit
>> 
>>   c12a508 ("Add client_state struct.")
>> 
>> inadvertently changed the default behavior of GDBserver wrt address
>> randomization.  The old disable_randomization global variable was
>> initialized to 1, whereas the corresponding field in the client_state
>> structure is initialized to 0.
>> 
>> This fixes
>> 
>>   make check TESTS="gdb.base/jit-simple.exp" 
>> RUNTESTFLAGS="--target_board=native-gdbserver"
>>   make check TESTS="gdb.base/execl-update-breakpoints.exp" 
>> RUNTESTFLAGS="--target_board=native-gdbserver"
>> 
>> Note that the execl-update-breakpoints.exp would only fail on systems
>> where the toolchain emits position-independent executables by default
>> (otherwise the main executable position is never randomized, so the
>> value of disable_randomization didn't matter).
> 
> Thanks for fixing this!
> 
> This is OK, but please double-check the patch/commit, since it
> seems to include the same hunk twice.  Kind of looks like
> the fix diff made it to the commit log?

Oops yes, it's because I use "git commit -v" and managed to include that 
diff in the commit message by mistake.

Pushed with that fixed.

Simon

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Restore behavior of disabling address randomization by default on GDBserver
  2018-08-22 17:38   ` Simon Marchi
@ 2018-08-26  9:51     ` Joel Brobecker
  2018-08-26 15:01       ` Simon Marchi
  0 siblings, 1 reply; 5+ messages in thread
From: Joel Brobecker @ 2018-08-26  9:51 UTC (permalink / raw)
  To: Simon Marchi; +Cc: Pedro Alves, Simon Marchi, gdb-patches

Hello,

> > Thanks for fixing this!
> > 
> > This is OK, but please double-check the patch/commit, since it
> > seems to include the same hunk twice.  Kind of looks like
> > the fix diff made it to the commit log?
> 
> Oops yes, it's because I use "git commit -v" and managed to include that
> diff in the commit message by mistake.
> 
> Pushed with that fixed.

Just a quick message to let you know that I cherry-picked the patch and
pushed it to gdb-8.2-branch. I think we wanted this to be fixed there,
right? And the patch looked sufficiently obvious to me that I went
ahead.

2018-08-26  Simon Marchi  <simon.marchi@ericsson.com>

	PR gdb/23374
	PR gdb/23375
	* server.h (struct client_state) <disable_randomization>:
	Initialize to 1.

-- 
Joel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Restore behavior of disabling address randomization by default on GDBserver
  2018-08-26  9:51     ` Joel Brobecker
@ 2018-08-26 15:01       ` Simon Marchi
  0 siblings, 0 replies; 5+ messages in thread
From: Simon Marchi @ 2018-08-26 15:01 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: Pedro Alves, Simon Marchi, gdb-patches

On 2018-08-26 05:50, Joel Brobecker wrote:
> Hello,
> 
>> > Thanks for fixing this!
>> >
>> > This is OK, but please double-check the patch/commit, since it
>> > seems to include the same hunk twice.  Kind of looks like
>> > the fix diff made it to the commit log?
>> 
>> Oops yes, it's because I use "git commit -v" and managed to include 
>> that
>> diff in the commit message by mistake.
>> 
>> Pushed with that fixed.
> 
> Just a quick message to let you know that I cherry-picked the patch and
> pushed it to gdb-8.2-branch. I think we wanted this to be fixed there,
> right? And the patch looked sufficiently obvious to me that I went
> ahead.

Of course, fixing the bug for 8.2 was the reason for that bug hunt in 
the first place.  Thanks!

Simon

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-08-26 15:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-22 16:06 [PATCH] Restore behavior of disabling address randomization by default on GDBserver Simon Marchi
2018-08-22 16:14 ` Pedro Alves
2018-08-22 17:38   ` Simon Marchi
2018-08-26  9:51     ` Joel Brobecker
2018-08-26 15:01       ` Simon Marchi

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).