Mailing List Archive

Executing hardened-binaries on non-hardened systems
Hi,

I need to compile a binary on my system and copy it over to
some other Linux machine (non-Gentoo) to execute it there. I
can't compile the binary on the target machine; I have to do
it elsewhere.

Now the problem is that my system uses hardened gcc 3.3.4.
Thus, when I execute the binary on the non-hardened machine,
I get this error:

./foobar: relocation error: ./foobar: symbol __guard,
version GLIBC_2.3.2 not defined in file libc.so.6 with
link time reference

OK. I understand that. But what do I do now?

I tried compiling the program with "-fno-stack-protector
-fno-pic", but that doesn't make any difference. Probably
because the libraries the program links against have been
compiled with that stuff already.

Is there any way to get this symbol defined _except_ for
linking libc statically? Some magic libnow_it_all_works.a,
perhaps? :-)

Peter


--
gentoo-hardened@gentoo.org mailing list
Re: Executing hardened-binaries on non-hardened systems [ In reply to ]
On Thu, 2004-09-23 at 17:47, Peter Simons wrote:
> Hi,
>
> I need to compile a binary on my system and copy it over to
> some other Linux machine (non-Gentoo) to execute it there. I
> can't compile the binary on the target machine; I have to do
> it elsewhere.
>
> Now the problem is that my system uses hardened gcc 3.3.4.
> Thus, when I execute the binary on the non-hardened machine,
> I get this error:
>
> ./foobar: relocation error: ./foobar: symbol __guard,
> version GLIBC_2.3.2 not defined in file libc.so.6 with
> link time reference
>
> OK. I understand that. But what do I do now?
>
> I tried compiling the program with "-fno-stack-protector
> -fno-pic", but that doesn't make any difference. Probably
> because the libraries the program links against have been
> compiled with that stuff already.
>
> Is there any way to get this symbol defined _except_ for
> linking libc statically? Some magic libnow_it_all_works.a,
> perhaps? :-)

---- libssp_pic.a ----
gcc -fno-stack-protector -fno-stack-protector-all -fPIC $(portageq
envvar PORTDIR)/sys-libs/glibc/files/2.3.3/ssp.c -c
ar -cr libssp_pic.a ssp.o

----- libssp.a -----
gcc -fno-stack-protector -fno-stack-protector-all $(portageq envvar
PORTDIR)/sys-libs/glibc/files/2.3.3/ssp.c -c
ar -cr libssp.a ssp.o

---- libssp.so ----
gcc -fno-stack-protector -fno-stack-protector-all $(portageq envvar
PORTDIR)/sys-libs/glibc/files/2.3.3/ssp.c -fPIC -shared -o libssp.so

Be sure to use -fno- when building these or you will trigger ssp on
itself.

good luck and hope it works for you.

>
> Peter
>
>
> --
> gentoo-hardened@gentoo.org mailing list
--
Ned Ludd <solar@gentoo.org>
Gentoo (hardened,security,infrastructure,embedded,toolchain) Developer