public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* does -fstack-protector work for gcc 4.1 on Darwin 8?
@ 2005-08-04  0:52 Jack Howarth
  2005-08-04  0:54 ` Eric Christopher
  2005-08-04  1:03 ` Richard Henderson
  0 siblings, 2 replies; 8+ messages in thread
From: Jack Howarth @ 2005-08-04  0:52 UTC (permalink / raw)
  To: gcc

   Does anyone know if the -fstack-protector option in gcc 4.1 branch
works on Darwin 8 (Tiger)? I can compile binaries with it but I'm not
sure how to test its functionality. Also, this is based on IBM's ProPolice
code, right?
             Jack

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: does -fstack-protector work for gcc 4.1 on Darwin 8?
  2005-08-04  0:52 does -fstack-protector work for gcc 4.1 on Darwin 8? Jack Howarth
@ 2005-08-04  0:54 ` Eric Christopher
  2005-08-04  1:03 ` Richard Henderson
  1 sibling, 0 replies; 8+ messages in thread
From: Eric Christopher @ 2005-08-04  0:54 UTC (permalink / raw)
  To: Jack Howarth; +Cc: gcc


On Aug 3, 2005, at 5:48 PM, Jack Howarth wrote:

>    Does anyone know if the -fstack-protector option in gcc 4.1 branch
> works on Darwin 8 (Tiger)? I can compile binaries with it but I'm not
> sure how to test its functionality. Also, this is based on IBM's  
> ProPolice
> code, right?
>

I'm surprised you could compile code until today - it wouldn't link  
the ssp libraries in...

Anyhow, it seems to work in my limited testing after I checked in a  
couple of patches.

-eric

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: does -fstack-protector work for gcc 4.1 on Darwin 8?
  2005-08-04  0:52 does -fstack-protector work for gcc 4.1 on Darwin 8? Jack Howarth
  2005-08-04  0:54 ` Eric Christopher
@ 2005-08-04  1:03 ` Richard Henderson
  1 sibling, 0 replies; 8+ messages in thread
From: Richard Henderson @ 2005-08-04  1:03 UTC (permalink / raw)
  To: Jack Howarth; +Cc: gcc

On Wed, Aug 03, 2005 at 08:48:46PM -0400, Jack Howarth wrote:
> Also, this is based on IBM's ProPolice code, right?

Logically.  It's a complete rewrite.


r~

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: does -fstack-protector work for gcc 4.1 on Darwin 8?
  2005-08-04  3:50 ` Richard Henderson
@ 2005-08-08 22:48   ` Nix
  0 siblings, 0 replies; 8+ messages in thread
From: Nix @ 2005-08-08 22:48 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Jack Howarth, gcc

On 4 Aug 2005, Richard Henderson whispered secretively:
> On Wed, Aug 03, 2005 at 09:39:13PM -0400, Jack Howarth wrote:
>>     Do you think I should be able to build gcc itself with the
>> -fstack-protector flag and what is the most appropriate way to
>> achieve that (ie brute force using a CFLAG or some configure
>> flag)?
> 
> Considering that I don't think that self-building with 
> -fstack-protector will ever be common, I don't think we
> ought to spend too many brain cells on this.

It was always possible with the SSP implementation, FWIW.
(This was useful to get a libgcc compiled with -fstack-protector,
although it's true that changing the TCFLAGS in gcc/Makefile
also lets you do that.)

> The only way to bootstrap with -fstack-protector without
> existing support in libc is to use a top-level bootstrap.

... which is reasonable, I think. (This was also true of
SSP.)

-- 
`Tor employs several thousand editors who they keep in dank
 subterranean editing facilities not unlike Moria' -- James Nicoll 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: does -fstack-protector work for gcc 4.1 on Darwin 8?
@ 2005-08-04  5:18 Jack Howarth
  0 siblings, 0 replies; 8+ messages in thread
From: Jack Howarth @ 2005-08-04  5:18 UTC (permalink / raw)
  To: gcc

Richard,
   Is there some sample code that one can use to test the 
functionality of the code generated by -fstack-protector?
Also, if one has a buggy program that is corrupting the stack,
what is the expected behavior of this program when compiled
with the stack protection code? Should it always abort at
runtime with a userful error message or will it manage to
suppress the stack corruption and keep on running. I was hoping
to use the stack protection code as way to flag the position of
offending code that was corrupting the stack rather than mask
the corruption itself. Thanks in advance for any clarifications.
            Jack

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: does -fstack-protector work for gcc 4.1 on Darwin 8?
  2005-08-04  1:42 Jack Howarth
@ 2005-08-04  3:50 ` Richard Henderson
  2005-08-08 22:48   ` Nix
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Henderson @ 2005-08-04  3:50 UTC (permalink / raw)
  To: Jack Howarth; +Cc: gcc

On Wed, Aug 03, 2005 at 09:39:13PM -0400, Jack Howarth wrote:
>     Do you think I should be able to build gcc itself with the
> -fstack-protector flag and what is the most appropriate way to
> achieve that (ie brute force using a CFLAG or some configure
> flag)?

Considering that I don't think that self-building with 
-fstack-protector will ever be common, I don't think we
ought to spend too many brain cells on this.

The only way to bootstrap with -fstack-protector without
existing support in libc is to use a top-level bootstrap.

That said, I don't think this really addresses what you
want to accomplish...

> I am interested in doing this so that I can have a 
> libgfortran built with -fstack-protector to try to track down
> a potential stack corruption problem. Thanks in advance for any
> advice.

This should be as simple as 

  make all-gcc
  make all-target-libssp
  make CFLAGS_FOR_TARGET='-O -g -fstack-protector-all' all-target-libgfortran

and then explicitly build your test program with -fstack-protector-all
so that the right libraries get linked in.


r~

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: does -fstack-protector work for gcc 4.1 on Darwin 8?
@ 2005-08-04  1:42 Jack Howarth
  2005-08-04  3:50 ` Richard Henderson
  0 siblings, 1 reply; 8+ messages in thread
From: Jack Howarth @ 2005-08-04  1:42 UTC (permalink / raw)
  To: gcc; +Cc: rth

Richard,
    Do you think I should be able to build gcc itself with the
-fstack-protector flag and what is the most appropriate way to
achieve that (ie brute force using a CFLAG or some configure
flag)? I am interested in doing this so that I can have a 
libgfortran built with -fstack-protector to try to track down
a potential stack corruption problem. Thanks in advance for any
advice.
           Jack

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: does -fstack-protector work for gcc 4.1 on Darwin 8?
@ 2005-08-04  1:15 Jack Howarth
  0 siblings, 0 replies; 8+ messages in thread
From: Jack Howarth @ 2005-08-04  1:15 UTC (permalink / raw)
  To: echristo, howarth; +Cc: gcc

Eric,
   Well what I have is a gfortran 4.1 branch fink package built using
the 20050728 cvs with the new cray pointer patches donated by LANL.
What I am trying to do is the following. I have been trying to build
xplor-nih (which is a mix of c, c++ and fortran) with gfortran (it
works okay with g77 or xlf). The new problem I have run into is
some stack and heap corruption with both gfortran from 4.0 and 4.1
branch. The current suspect is the new cray pointer patches for
Fortran which provide the necessary LOC intrinsic. My hope is that
if compile xplor-nih with -fstack-protector on the fortran code
when the stack is going to be corrupted it will throw a runtime
error thus identify the culprit. Does this sound like a valid use
of -fstack-protector?
          Jack
ps As a test I built the cp_test.f90 cray pointer test program
under gfortran with -fstack-protector. The resulting program
passed its tests but I have no idea if that means the stack
protector code itself was functional.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2005-08-08 22:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-04  0:52 does -fstack-protector work for gcc 4.1 on Darwin 8? Jack Howarth
2005-08-04  0:54 ` Eric Christopher
2005-08-04  1:03 ` Richard Henderson
2005-08-04  1:15 Jack Howarth
2005-08-04  1:42 Jack Howarth
2005-08-04  3:50 ` Richard Henderson
2005-08-08 22:48   ` Nix
2005-08-04  5:18 Jack Howarth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).