Re: Compiler alternatives to no-exec (was Re: non exec stack...)

Alexander Kjeldaas (astor@guardian.no)
Tue, 11 Aug 1998 20:00:11 +0200


On Tue, Aug 11, 1998 at 07:23:10PM +0200, Erik Corry wrote:
>
> Are you aware of Stackguard. They have a modified gcc that does
> more or less this, and are in the process of building a version
> of Red Hat 5.1 that uses it. It was already mentioned here:
>
> http://www.cse.ogi.edu/DISC/projects/immunix/StackGuard/
>

Yes, I looked at their patch for gcc 2.7.2.2 and took the general
structure from that patch. However, the backend for egcs is a bit
different (it uses RTL instead of more or less just printing out the
epilogue) so the StackGuard patch doesn't work on that compiler.

StackGuard has a bit more overhead. Basically it has 7 instructions
per function call plus another 21 instructions and a string (the
function name). This makes it possible for StackGuard to print the
name of the offending function. I want something very light, so I was
planning on having just one rescue function that goes something like:

void stack_overrun_abort(void) {
printf("Stack overrun detected, addr=%p\n",
__builtin_return_address(0));
abort();
}

StackGuard's overhead shows in the performance table on the web-site.
It looks like they have about 5-30% overhead, compared to what I
measured which was around 0.5 to 1.5% overhead. I'm not sure why this
is, considering that the technique is similar.

But anyway, neither my patch or StackGuard is the right patch since
they live in the architecture-dependent parts of gcc. A patch like
this should really be architecture independent.

astor

-- 
 Alexander Kjeldaas, Guardian Networks AS, Trondheim, Norway
 http://www.guardian.no/

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html