Page 1 of 1

stack-protector flag invalid on newer gcc?

Posted: Fri May 29, 2009 9:24 pm
by earlz
Hi, this is my version of gcc

Code: Select all

Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.6/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-java-awt=gtk --host=i386-redhat-linux
Thread model: posix
gcc version 3.4.6 20060404 (Red Hat 3.4.6-3)
This is on a server, so I can't just build and install a different gcc..

Anyway I get

Code: Select all

cc1: error: unrecognized command line option "-fno-stack-protector"
Although this flag works perfectly fine with my older gcc on my workstation

Code: Select all

Reading specs from /usr/lib/gcc-lib/i386-unknown-openbsd4.5/3.3.5/specs
Configured with:
Thread model: single
gcc version 3.3.5 (propolice)
is there like a new -fno-stack-protector flag or something? or is my gcc just heavily patched to include "new" features(newer than what is on my server)

I really do not know how to detect if that flag works and if so then use it(I expect that would take some autoconf crap.. which I don't feel like dealing with)

Re: stack-protector flag invalid on newer gcc?

Posted: Sat May 30, 2009 8:11 am
by Brynet-Inc
As I've mentioned to you a couple times off the forum, OpenBSD's version of GCC is customized.. see gcc-local(1).

The stack protector was originally a 3rd party patch called "ProPolice", newer versions of GCC/binutils include something similar.. but it's not enabled by default.

http://en.wikipedia.org/wiki/Buffer_ove ... oPolice.29
http://www.research.ibm.com/trl/projects/security/ssp/

You really should be building a cross-compiler on both your remote system and your home systems, it's not that hard..

http://wiki.osdev.org/GCC_Cross-Compiler

Re: stack-protector flag invalid on newer gcc?

Posted: Sat May 30, 2009 12:40 pm
by bewing
That is, if you have a big enough local user diskspace quota.

Re: stack-protector flag invalid on newer gcc?

Posted: Sat May 30, 2009 4:33 pm
by earlz
bewing wrote:That is, if you have a big enough local user diskspace quota.
Well I have 100G of space.. I was just too lazy to build a cross-compiler..

If I really must build a cross-compiler though, I'd rather just take PCC and use it, as it is much smaller and light weight, and my OS has support for it(I regularly build with both PCC and GCC on my workstation.. I like building with PCC as it is like 10 seconds faster)