Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Perl: porters

Re: Change 33843: [perl #54120] [PATCH] [metaconfig] Need more -fstack-protector

 

 

Perl porters RSS feed   Index | Next | Previous | View Threaded


nick at ccl4

May 20, 2008, 7:59 AM

Post #1 of 3 (73 views)
Permalink
Re: Change 33843: [perl #54120] [PATCH] [metaconfig] Need more -fstack-protector

On Sat, May 17, 2008 at 07:00:03AM -0700, H. Merijn Brand wrote:
> Change 33843 by merijn[at]merijn-nb09 on 2008/05/17 13:56:26
>
> Subject: [perl #54120] [PATCH] [metaconfig] Need more -fstack-protector
> From: Andy Dougherty (via RT) <perlbug-followup[at]perl.org>
> Date: Tue, 13 May 2008 09:37:07 -0700
> Message-ID: <rt-3.6.HEAD-9992-1210696625-331.54120-75-0[at]perl.org>


> @@ -5258,6 +5258,10 @@
> 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

this isn't perfect, because it's in this:


: 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*.
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?

Nicholas Clark


doughera at lafayette

May 20, 2008, 8:21 AM

Post #2 of 3 (69 views)
Permalink
Re: Change 33843: [perl #54120] [PATCH] [metaconfig] Need more -fstack-protector [In reply to]

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)

--- 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

--
Andy Dougherty doughera[at]lafayette.edu


h.m.brand at xs4all

May 20, 2008, 8:32 AM

Post #3 of 3 (67 views)
Permalink
Re: Change 33843: [perl #54120] [PATCH] [metaconfig] Need more -fstack-protector [In reply to]

On Tue, 20 May 2008 11:21:14 -0400 (EDT), Andy Dougherty
<doughera[at]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
>

--
H.Merijn Brand Amsterdam Perl Mongers (http://amsterdam.pm.org/)
using & porting perl 5.6.2, 5.8.x, 5.10.x on HP-UX 10.20, 11.00, 11.11,
& 11.23, SuSE 10.1 & 10.2, AIX 5.2, and Cygwin. http://qa.perl.org
http://mirrors.develooper.com/hpux/ http://www.test-smoke.org
http://www.goldmark.org/jeff/stupid-disclaimers/

Perl porters RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.