Bug 14206 - Mention that exec-shield-randomize (linux) conflicts with PCH
Summary: Mention that exec-shield-randomize (linux) conflicts with PCH
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 3.4.0
Assignee: Not yet assigned to anyone
URL:
Keywords: documentation, patch
Depends on:
Blocks:
 
Reported: 2004-02-19 05:04 UTC by Giovanni Bajo
Modified: 2005-07-20 02:31 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.0.0
Known to fail: 3.4.0
Last reconfirmed: 2004-02-19 05:08:16


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Giovanni Bajo 2004-02-19 05:04:53 UTC
Within http://gcc.gnu.org/install/specific.html, we should really mention that 
exec-shield conflicts with PCH causing random failures. 

http://gcc.gnu.org/ml/gcc-patches/2004-02/msg01711.html
http://gcc.gnu.org/ml/gcc-patches/2004-02/msg01715.html

I can provide a patch in a few days, this is just so that we don't forget about 
it.
Comment 1 Andrew Pinski 2004-02-19 05:08:15 UTC
Confirmed, this is really needed for 3.4.0.
Comment 2 Alexandre Oliva 2004-02-19 05:46:13 UTC
FWIW, the conflict is not with exec-shield per se, but rather with
exec-shield-randomize, the feature that gets the kernel to randomize memory
mappings.  It turns out that the PCH mechanism was built upon the mis-assumption
that memory maps are invariant.  I'd rather qualify this as a bug in the PCH
implementation.
Comment 3 Giovanni Bajo 2004-02-19 12:00:14 UTC
Speaking with Geoff in IRC, it turns out that the implementation can be fixed 
so that it works even with the randomizer, but it needs someone to work on it. 
Meanwhile, we really need to document the issue.
Comment 4 Geoff Keating 2004-02-19 21:45:51 UTC
Subject: Re:  Mention that exec-shield (linux) conflicts with PCH

"aoliva at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:

> ------- Additional Comments From aoliva at gcc dot gnu dot org  2004-02-19 05:46 -------
> FWIW, the conflict is not with exec-shield per se, but rather with
> exec-shield-randomize, the feature that gets the kernel to randomize memory
> mappings.  It turns out that the PCH mechanism was built upon the mis-assumption
> that memory maps are invariant.  I'd rather qualify this as a bug in the PCH
> implementation.

The host is supposed to ensure that the memory region it chooses will
be available in future invocations of the compiler; there's a host
hook so it can communicate the region it chose to the PCH machinery.
However, the hook is not implemented for linux, because no-one has
stepped forward to do it, so the PCH machinery falls back to a
heuristic that works on many systems (but apparantly not on linux if
exec-shield-randomize is switched on).

Alternatively, the PCH implementation was designed to allow PCH files
to be relocated.  However, this support was never implemented, because
(a) no interesting host seemed to need it, (b) relocation would be
very expensive, so it's usually worthwhile to put a bit of effort into
ensuring that relocation is not needed, and (c) in practise it turns
out that avoiding the need for relocation is easier than implementing
relocation.

Comment 5 Giovanni Bajo 2004-03-02 19:24:48 UTC
It wouldn't be bad to document this within changes.html too, since exec-shield 
appears to be turned on by default on FC1. At least, a link to specific.html.
Comment 6 Giovanni Bajo 2004-03-03 12:42:25 UTC
Ian just verified that the problem is exec-shield-randomize and not exec-shield 
itself, so turing the former off is enough to fix the problem:

http://gcc.gnu.org/ml/gcc/2004-03/msg00201.html
Comment 7 Ian Lance Taylor 2004-03-25 05:57:52 UTC
Here is a documentation patch for 3.4.0:
http://gcc.gnu.org/ml/gcc-patches/2004-03/msg02068.html

This is already fixed in 3.5.
Comment 8 GCC Commits 2004-03-27 03:37:48 UTC
Subject: Bug 14206

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	ian@gcc.gnu.org	2004-03-27 03:37:37

Modified files:
	gcc            : ChangeLog 
	gcc/doc        : install.texi 

Log message:
	PR target/14206
	* doc/install.texi (Specific): Document that exec-shield-randomize
	interferes with precompiled headers.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.372&r2=2.2326.2.373
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/doc/install.texi.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.248.4.13&r2=1.248.4.14

Comment 9 Ian Lance Taylor 2004-03-27 03:39:11 UTC
The docs have been fixed for 3.4.0.

The code has been fixed on mainline for 3.5 and later.
Comment 10 Giovanni Bajo 2004-03-27 13:39:04 UTC
Subject: Re:  Mention that exec-shield-randomize (linux) conflicts with PCH

ian at wasabisystems dot com wrote:

> The docs have been fixed for 3.4.0.

Ian, would you add also something to http://gcc.gnu.org/install/specific.html?

Giovanni Bajo


Comment 11 Ian Lance Taylor 2004-03-29 16:39:31 UTC
Subject: Re:  Mention that exec-shield-randomize (linux) conflicts with PCH

"giovannibajo at libero dot it" <gcc-bugzilla@gcc.gnu.org> writes:

> Ian, would you add also something to http://gcc.gnu.org/install/specific.html?

Isn't that file automatically generated somehow?

I don't know how, but it sure looks like the Texinfo docs, and it
doesn't seem to be in the wwwdocs repository.

Ian
Comment 12 Andrew Pinski 2004-03-29 16:42:44 UTC
Subject: Re:  Mention that exec-shield-randomize (linux) conflicts with PCH


On Mar 29, 2004, at 11:39, ian at wasabisystems dot com wrote:

>
> ------- Additional Comments From ian at wasabisystems dot com  
> 2004-03-29 16:39 -------
> Subject: Re:  Mention that exec-shield-randomize (linux) conflicts 
> with PCH
>
> "giovannibajo at libero dot it" <gcc-bugzilla@gcc.gnu.org> writes:
>
>> Ian, would you add also something to 
>> http://gcc.gnu.org/install/specific.html?
>
> Isn't that file automatically generated somehow?
>
> I don't know how, but it sure looks like the Texinfo docs, and it
> doesn't seem to be in the wwwdocs repository.
>
> Ian


It is part of doc/install.texi.

Thanks,
Andrew Pinski

Comment 13 Ian Lance Taylor 2004-03-29 16:48:08 UTC
Subject: Re:  Mention that exec-shield-randomize (linux) conflicts with PCH

"pinskia at physics dot uc dot edu" <gcc-bugzilla@gcc.gnu.org> writes:

> > "giovannibajo at libero dot it" <gcc-bugzilla@gcc.gnu.org> writes:
> >
> >> Ian, would you add also something to 
> >> http://gcc.gnu.org/install/specific.html?
> >
> > Isn't that file automatically generated somehow?
> >
> > I don't know how, but it sure looks like the Texinfo docs, and it
> > doesn't seem to be in the wwwdocs repository.
> 
> It is part of doc/install.texi.

Good, because that is the patch which I already made.

Ian
Comment 14 gschafer 2005-07-20 02:31:44 UTC
Stock Linux kernel 2.6.12 introduced "address space randimization" which appears
to be essentially the same thing as RH's exec-shield-randomize. More info about
this issue here:

  http://gcc.gnu.org/ml/gcc/2005-07/msg00851.html