Stack protector broken in gcc41?

Hasso Tepper hasso at
Tue Apr 15 00:02:40 PDT 2008

Matthew Dillon wrote:
> :Even hello world fails to link:
> :
> :~$ gcc -fstack-protector-all -o hello-world hello-world.c
> :/tmp//cckehwVf.o: In function `main':
> :hello-world.c:(.text+0x12): undefined reference to `__stack_chk_guard'
> :hello-world.c:(.text+0x35): undefined reference to `__stack_chk_guard'
> :hello-world.c:(.text+0x3c): undefined reference to `__stack_chk_fail'
> :~$
> :
> :--
> :Hasso Tepper
>     They must have changed the symbols.  libc only has the
>     __stack_smash_handler symbol (which is what the original stack
>     protector code needed).
>     It sounds like the new symbols and supporting code will have to be
>     added to libc.
>     FreeBSD seems to have an implementation, though they are using a
>     sysctl to get the random seed.  A little surgery to replace
>     that with our /dev/urandom code and we'd be golden:
>     leaf:/archive/FreeBSD-current/src/lib/libc/sys/stack_protector.c

Yeah, but should we take care of preserving symbols for old stuff as well? 
We would break binaries compiled with gcc34 otherwise?

Hasso Tepper

More information about the Users mailing list