From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3639 invoked by alias); 22 Aug 2018 16:14:48 -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 3624 invoked by uid 89); 22 Aug 2018 16:14:47 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.3 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 22 Aug 2018 16:14:46 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9A8568573E; Wed, 22 Aug 2018 16:14:44 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1C16A2026D74; Wed, 22 Aug 2018 16:14:43 +0000 (UTC) Subject: Re: [PATCH] Restore behavior of disabling address randomization by default on GDBserver To: Simon Marchi , gdb-patches@sourceware.org References: <1534953958-13064-1-git-send-email-simon.marchi@ericsson.com> From: Pedro Alves Message-ID: <1ad11ede-9a61-5ead-921a-bf2c1c1a6358@redhat.com> Date: Wed, 22 Aug 2018 16:14:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <1534953958-13064-1-git-send-email-simon.marchi@ericsson.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2018-08/txt/msg00540.txt.bz2 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) : > 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