This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Worm and virus free code.
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: Ian Lance Taylor <ian at wasabisystems dot com>
- Cc: markw <markw at mohawksoft dot com>, gcc at gnu dot org
- Date: 29 Sep 2003 13:08:06 -0300
- Subject: Re: Worm and virus free code.
- Organization: GCC Team, Red Hat
- References: <3F746517.5020306@mohawksoft.com><m3d6dk5rc6.fsf@gossamer.airs.com>
On Sep 28, 2003, Ian Lance Taylor <ian@wasabisystems.com> wrote:
> This could be done at load time on an ELF system. It doesn't require
> any compiler work. The relatively easy way is to compile all your
> code with -fPIC, perhaps tweak the linker slightly to preserve all
> relocations in the executable, and tell the loader to randomize the
> load address.
That's called PIE (position-independent executable), and it has been
done before. GCC supports -fPIE, and recent versions of GNU ld
support -pie. There are patches for Linux (the kernel) that randomize
the load address of PIEs. These patches are available in the kernel
that ships with the Fedora Core test2 release. More information about
this feature is available in the release notes.
http://fedora.redhat.com/
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist Professional serial bug killer