From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20908 invoked by alias); 8 Jun 2008 10:39:19 -0000 Received: (qmail 20900 invoked by uid 22791); 8 Jun 2008 10:39:19 -0000 X-Spam-Check-By: sourceware.org Received: from mtaout2.012.net.il (HELO mtaout2.012.net.il) (84.95.2.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 08 Jun 2008 10:38:54 +0000 Received: from HOME-C4E4A596F7 ([80.230.28.131]) by i_mtaout2.012.net.il (HyperSendmail v2004.12) with ESMTPA id <0K2500A2B4XMIU00@i_mtaout2.012.net.il> for gdb-patches@sourceware.org; Sun, 08 Jun 2008 13:53:48 +0300 (IDT) Date: Sun, 08 Jun 2008 10:39:00 -0000 From: Eli Zaretskii Subject: Re: [patch] Disable child VMA randomizations In-reply-to: <20080608094213.GA14515@host0.dyn.jankratochvil.net> X-012-Sender: halo1@inter.net.il To: Jan Kratochvil Cc: gdb-patches@sourceware.org Reply-to: Eli Zaretskii Message-id: References: <20080607195343.GA10039@host0.dyn.jankratochvil.net> <20080607195343.GA10039@host0.dyn.jankratochvil.net> <20080608094213.GA14515@host0.dyn.jankratochvil.net> X-IsSubscribed: yes 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 X-SW-Source: 2008-06/txt/msg00133.txt.bz2 > Date: Sun, 8 Jun 2008 11:42:13 +0200 > From: Jan Kratochvil > Cc: gdb-patches@sourceware.org, Andreas Schwab > > > > +Standalone programs run with the randomization enabled by default."), > > > > On some platforms, right? > > Fixed. > > Standalone programs run with the\n\ > +randomization enabled by default on the GNU/Linux platform."), I think "on some platforms" is better, as we won't need to update the list each time another platform adds support for it. (Btw, doesn't Windows Vista already do that?) > > > +get assigned differently on each run some subtle bugs may be reproducible only > > > +with specially assigned addresses possibly not reachable with the default > > > +setting of @kbd{set disable-randomization on}. > > > > Can you explain this sentence? I'd like to suggest a better wording, > > but I can't do that unless I understand what is it that you are trying > > to say here. > > New text: > > As some debuggee's > +bugs may depend on the assigned addresses the default @value{GDBN} behavior of > +disabling the randomization may make some debuggee's bugs unreproducible. You > +may want to run the debuggee many times with the randomization enabled (and > +thus this option disabled) to catch such kind of bugs. Correctly written > +programs must run the same way notwithstanding this configuration option. I suggest this modified text: Some bugs rear their ugly heads only when the program is loaded at certain addresses. If your bug disappears when you run the program under @value{GDBN}, that might be because @value{GDBN} by default disables the address randomization on platforms, such as @sc{gnu}/Linux, which do that for stand-alone programs. Use @kbd{set disable-randomization off} to try to reproduce such elusive bugs. > > > +PIE executables (type @code{ET_DYN}, compiled by @code{gcc -fPIE -pie}) have > > > +randomized everything - the executable base address, shared libraries base > > > +address (their prelinking is ignored), mmap areas, stack and heap. Regular > > > +executables (type @code{ET_EXEC}) do not have randomized their base address, > > > +shared libraries base address is ranomized only for non-prelinked libraries, > > > +mmap, stack and heap are still randomized. > > > > There's too much unexplained technical details here, so much so that > > this paragraph sounds like it was meant only for the initiated. > > It is mostly explained at: > http://lwn.net/Articles/190139/ > > I expected the full explanation is inappropriate for the GDB manual but I tried > to include it in this patch: Thanks. It needs a bit more work, but now that I understand the issues, I can do it myself. Go ahead and commit the doco patch, and I will revisit it when I have time. > +The virtual address space randomization is implemented only on @sc{gnu}/Linux. Btw, according to the above URL, this is not true: it says that OpenBSD and Adamantix (whatever that is) have it as well.