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.
Confirmed, this is really needed for 3.4.0.
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.
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.
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.
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.
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
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.
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
The docs have been fixed for 3.4.0. The code has been fixed on mainline for 3.5 and later.
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
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
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
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
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