From: Daniel Jacobowitz <drow@false.org>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: Mark Kettenis <mark.kettenis@xs4all.nl>, gdb-patches@sourceware.org
Subject: Re: [patch] Disable child VMA randomizations
Date: Thu, 26 Jun 2008 15:52:00 -0000 [thread overview]
Message-ID: <20080626144150.GL22726@caradoc.them.org> (raw)
In-Reply-To: <20080608164331.GA6358@host0.dyn.jankratochvil.net>
Please also add the new commands to NEWS.
On Sun, Jun 08, 2008 at 06:43:31PM +0200, Jan Kratochvil wrote:
> @@ -149,6 +156,19 @@ show_debug_linux_nat_async (struct ui_fi
> value);
> }
>
> +#ifdef HAVE_PERSONALITY
> +static int disable_randomization = 1;
> +
> +static void
> +show_disable_randomization (struct ui_file *file, int from_tty,
> + struct cmd_list_element *c, const char *value)
> +{
> + fprintf_filtered (file, _("\
> +Disabling randomization of debuggee's virtual address space is %s.\n"),
> + value);
> +}
> +#endif /* HAVE_PERSONALITY */
> +
> static int linux_parent_pid;
>
> struct simple_pid_list
I think it would be better to register the command unconditionally,
but only call personality if it is available. I'd like to keep
conditionally compiled code to a minimum.
> + warning (_("Error setting the enabled disable-randomization: %s"),
Error disabling address space randomization:
> + safe_strerror (errno));
> + }
> +#endif /* HAVE_PERSONALITY */
> +
> linux_ops->to_create_inferior (exec_file, allargs, env, from_tty);
>
> +#ifdef HAVE_PERSONALITY
> + if (personality_set)
> + {
> + errno = 0;
> + personality (personality_orig);
> + if (errno != 0)
> + warning (_("Problem restoring the disable-randomization state: %s"),
Error restoring address space randomization:
> +When this mode is on (which is the default), the randomization of\n\
> +the virtual address space is disabled. Standalone programs run with the\n\
> +randomization enabled by default on some platforms."),
You don't need "the" before randomization in this case (two places).
> +misusing it. Still even a prelinked shared library can get loaded a a new
at a
> + gdb_test_multiple "continue" $testname {
> + -re "address = (0x\[0-9a-f\]*).*Program exited normally..*$gdb_prompt $" {
> + pass $testname
> + return $expect_out(1,string)
> + }
Please set a breakpoint and use GDB to print out the variable, instead
of relying on printf; some test configurations don't work with stdio.
They probably won't work with this test anyway, but no reason to
complicate things.
> +gdb_test "set disable-randomization off"
> +set addr1 [address_get "randomized first address"]
> +set addr2 [address_get "randomized second address"]
> +set test "randomized addresses should not match"
> +if {$addr1 eq $addr2} {
> + fail $test
> +} else {
> + pass $test
> +}
This test will only pass if the system supports address randomization
and has it enabled. I don't know about you, but the first thing I do
on a new developer system is turn it off...
--
Daniel Jacobowitz
CodeSourcery
next prev parent reply other threads:[~2008-06-26 14:42 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-07 19:54 Jan Kratochvil
2008-06-07 20:41 ` Andreas Schwab
2008-06-08 9:43 ` Jan Kratochvil
2008-06-08 10:39 ` Eli Zaretskii
2008-06-08 11:38 ` Jan Kratochvil
2008-06-07 20:43 ` Eli Zaretskii
2008-06-08 15:14 ` Mark Kettenis
2008-06-08 16:44 ` Jan Kratochvil
2008-06-26 15:52 ` Daniel Jacobowitz [this message]
2008-06-27 23:19 ` Jan Kratochvil
2008-07-09 21:15 ` Daniel Jacobowitz
2008-07-10 9:34 ` Jan Kratochvil
2008-07-12 21:16 ` Ulrich Weigand
2008-07-13 6:55 ` Jan Kratochvil
2008-07-15 18:41 ` Ulrich Weigand
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=20080626144150.GL22726@caradoc.them.org \
--to=drow@false.org \
--cc=gdb-patches@sourceware.org \
--cc=jan.kratochvil@redhat.com \
--cc=mark.kettenis@xs4all.nl \
/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