Vulnerability Development mailing list archives

Re: stackguard-like embedded protection


From: Hiroaki Etoh <ETOH () JP IBM COM>
Date: Wed, 13 Sep 2000 20:20:41 +0900

On 2000/09/13 18:29:31 antirez wrote:

On Mon, Sep 11, 2000 at 11:34:01AM +0900, Hiroaki Etoh wrote:
I don't think this solution is portable to any C compiler.  Because the
ordering
of local variables is very dependent of the implementation of compilers, for
example, Visual C++ by Microsoft.  I don't know the current version of GCC
compiler preserves the ordering of local variables. Therefore, I implemented
ProPolice at the intermediate language level.

I tested GCC i386 and sparc with a lot of optimizations and options:
it seems that if the variable is declared with the specifier 'volatile'
always goes next to the RET. I have no access to other compilers,
but since implementing ProPolice at the intermediate language level
you needs to implement it for all the compilers it seems that my
solution can be more portable in some case. For example it can work
in new compilers without changes, ProPolice can't.
Also ProPolice needs to be implemented in a different way for different
compilers: you can add #ifdefs to my header file to make it compatible
with strange-behaviour compilers.

I tested GCC aix, xlC aix, and Microsoft Visual C++. They don't place the
'volatile' variable next to the RET.  Could someone test the following program
in the other compilers. I am very interested in such information.

#include <stdio.h>
int main()
{
   volatile int x=0;
   char buf[20];
   printf("%s!! x:%x buf:%x\n", ((char*)&x>buf)?"ok":"no", &x, buf);
}

Hiroaki Etoh,  Tokyo Research Laboratory, IBM Japan


Current thread: