Front page | perl.perl5.porters |
Postings from May 2008
[perl #54120] [PATCH] [metaconfig] Need more -fstack-protector
From:
Steve Peters via RT
Date:
May 27, 2008 10:47
Subject:
[perl #54120] [PATCH] [metaconfig] Need more -fstack-protector
Message ID:
rt-3.6.HEAD-11257-1211910433-616.54120-15-0@perl.org
On Tue May 20 08:33:30 2008, hmbrand wrote:
> On Tue, 20 May 2008 11:21:14 -0400 (EDT), Andy Dougherty
> <doughera@lafayette.edu> wrote:
>
> > On Tue, 20 May 2008, Nicholas Clark via RT wrote:
> >
> > [patch to fiddle with -fstack-protector]
> >
> > > : flags used in final linking phase
> > > case "$ldflags" in
> > > '') if ./venix; then
> > > dflt='-i -z'
> > > else
> > > dflt=''
> > > fi
> > > case "$ccflags" in
> > > *-posix*) dflt="$dflt -posix" ;;
> > > esac
> > > # See note above about -fstack-protector
> > > case "$ccflags" in
> > > *-fstack-protector*) dflt="$dflt -fstack-protector" ;;
> > > esac
> > > ;;
> > > *) dflt="$ldflags";;
> > > esac
> > >
> > >
> > > I find that as soon as I use -Aldflags, I don't get
> -fstack-protector added.
> > > Which is somewhat daft, at least as an "end user", as I was using
> *A* not *D*.
> >
> > Oops. That's not supposed to happen. Sorry about that!
> >
> > There are actually two separate things going on here: First, the -A
> is
> > supposed to happen after platform-specific hints are done. By the
> time
> > we've reached this code, platform-specific hints have long been
> finished,
> > so the -A should indeed have been applied.
> >
> > The troublesome bit of code I quoted above is there to allow a use
> to tell
> > Configure: "use this exact string for ldflags, don't mess with it
> at
> > all." The thinking pre-dates Configure's -A flag. That's not what
> you
> > wanted to do, however.
> >
> > > I don't understand the implementation of Configure enough to know
> when -A
> > > processing is done, but is it done early enough that ldflags is
> already set by
> > > the time that that code above is reached?
> >
> > Yes, that's exactly it. And further, we've also lost all memory of
> > whether it was a -A or a -D addition.
> >
> > Clearly, that's a problem. I'll need to think on it a bit to figure
> out
> > how to fix it. I think the short-term fix will be to add
> > -fstack-protector no matter what. Something like this (sorry no
> > metaconfig patch here, but it should apply with a (large) offset)
>
> Hunk #1 succeeded at 377 (offset -4884 lines).
>
> The regenerated Configure seems to be under just a bit more impact.
> Regenerated in #33887
>
> > --- perl-current/Configure 2008-05-17 10:31:35.000000000 -0400
> > +++ perl-andy/Configure 2008-05-20 11:11:41.000000000 -0400
> > @@ -5261,13 +5261,18 @@
> > case "$ccflags" in
> > *-posix*) dflt="$dflt -posix" ;;
> > esac
> > - # See note above about -fstack-protector
> > - case "$ccflags" in
> > - *-fstack-protector*) dflt="$dflt -fstack-protector" ;;
> > - esac
> > ;;
> > *) dflt="$ldflags";;
> > esac
> > +# See note above about -fstack-protector
> > +case "$ccflags" in
> > +*-fstack-protector*)
> > + case "$dflt" in
> > + *-fstack-protector*) ;; # Don't add it again
> > + *) dflt="$dflt -fstack-protector" ;;
> > + esac
> > + ;;
> > +esac
> >
> > : Try to guess additional flags to pick up local libraries.
> > for thislibdir in $libpth; do
> >
>
This has gone in with changes #33886 (metaconfig) and #33887 (Configure)
-
[perl #54120] [PATCH] [metaconfig] Need more -fstack-protector
by Steve Peters via RT