[LLVMdev] Stack smashing

Eric Christopher echristo at apple.com
Tue Mar 10 15:12:09 PDT 2009


On Mar 10, 2009, at 3:07 PM, Jon Harrop wrote:

> On Tuesday 10 March 2009 21:47:59 someguy wrote:
>> From a cursory glance, it looks like something is messing with the
>> stack canarys. Probably a stack buffer overflow.
>
> In case it is relevant, HLVM uses libsigsegv to detect stack  
> overflows and
> that stack handler is initialized in my JITted code which LLVM's  
> runFunction
> should be calling.
>
> Could libsigsegv be conflicing with the stack smashing code?

If it changes known values on the stack - yes.

Basically it all works by placing a sentinel value on the stack  
initialized with a
random number that's then checked at the end of the function. If that  
has been
changed it calls abort().  IIRC the feature is turned on by default on  
modern
versions of linux. I do not believe it is yet turned on by default for  
darwin.

-eric



More information about the llvm-dev mailing list