This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: apps built w/ -fstack-protector-all segfault
- From: "Peter S. Mazinger" <ps dot m at gmx dot net>
- To: Richard Henderson <rth at redhat dot com>
- Cc: James E Wilson <wilson at specifix dot com>, <gcc at gcc dot gnu dot org>
- Date: Wed, 16 Nov 2005 22:32:45 +0100 (CET)
- Subject: Re: apps built w/ -fstack-protector-all segfault
On Wed, 16 Nov 2005, Richard Henderson wrote:
> On Wed, Nov 16, 2005 at 10:02:23PM +0100, Peter S. Mazinger wrote:
> > On Wed, 16 Nov 2005, Richard Henderson wrote:
> >
> > > On Wed, Nov 16, 2005 at 08:40:11PM +0100, Peter S. Mazinger wrote:
> > > > On Wed, 16 Nov 2005, Richard Henderson wrote:
> > > >
> > > > > On Tue, Nov 15, 2005 at 09:01:21PM +0100, Peter S. Mazinger wrote:
> > > > > > I meant exactly this, gcc supports -fno-stack-protector (although gcc
> > > > > > defaults to no-ssp), so -fno-stack-protector-all should be there too
> > > > >
> > > > > Why? What option would it perform?
> > > >
> > > > to have the possibility to override an earlier one, as it is done w/ many
> > > > fno* options. Why should this one not have it's counterpart.
> > >
> > > There are three states we can be in:
> > >
> > > (0) no stack protection -fno-stack-protector
> > > (1) heuristic stack protection -fstack-protector
> > > (2) all stack protection -fstack-protector-all
> > >
> > > All of these three states have corresponding switches. You can
> > > use any of them at any time.
> >
> > True for default configs. Let's consider though other distros like
> > ubuntu/adamantix/gentoo that can default to "(2) all stack protection"
> > but sometimes, due to problems (mainly c++) -all has to be disabled.
> > -fno-stack-protector would disable all the protection, that is not what
> > would be needed.
>
> Use -fstack-protector to return to state (1).
you missed the example earlier, or the behaviour of these 2 flags are not
like they were earlier.
what happens w/ -fstack-protector-all -fstack-protector (in this order) ?
do we have (2) or (1)
If the order is relevant then (1) will apply.
so now it does
-fstack-protector #define __SSP__ 1 ; #undef __SSP_ALL__
-fstack-protector-all #define __SSP_ALL__ 2 ; #undef __SSP__
and the last wins.
I think this is not quite correct, because -all is a
superset of -fstack-protector, so it also should define __SSP__ 1
Peter
--
Peter S. Mazinger <ps dot m at gmx dot net> ID: 0xA5F059F2
Key fingerprint = 92A4 31E1 56BC 3D5A 2D08 BB6E C389 975E A5F0 59F2