Hello llvm-commits, 
<div><br></div><div>I would ask you to consider the following patch, which adds the basic functionality of AddressSanitizer, a memory error detector. </div><div><br></div><div>Quick description: </div><div>  The tool finds stack and heap out-of-bound bugs and use-after-free bugs. </div>

<div>  It consists of an LLVM instrumentation pass and a run-time library which replaces malloc. </div><div>  The LLVM pass instruments all memory accesses and inserts redzones around stack objects and globals.</div><div>

  The run-time library inserts redzones around heap objects and handles error reporting. </div><div>  The slowdown introduced by the tool varies between 1.5x and 2.5x (on CPU2006 the average is 1.73x).</div><div><div>  </div>

<div>  Until now the tool was developed as a separate project. </div><div>  It has been quite successful at finding bugs for the Chromium browser project </div><div>  (<a href="http://blog.chromium.org/2011/06/testing-chromium-addresssanitizer-fast.html" target="_blank">http://blog.chromium.org/2011/06/testing-chromium-addresssanitizer-fast.html</a>)</div>

<div>  and other pieces of Google code. </div></div><div><br></div><div><div>  For the full description of the tool please read </div><div>  <a href="http://code.google.com/p/address-sanitizer/wiki/AddressSanitizer" target="_blank">http://code.google.com/p/address-sanitizer/wiki/AddressSanitizer</a></div>

<div>  <a href="http://code.google.com/p/address-sanitizer/wiki/AddressSanitizerAlgorithm" target="_blank">http://code.google.com/p/address-sanitizer/wiki/AddressSanitizerAlgorithm</a></div><div>  <a href="http://code.google.com/p/address-sanitizer/wiki/PerformanceNumbers" target="_blank">http://code.google.com/p/address-sanitizer/wiki/PerformanceNumbers</a></div>

<div><br></div></div><div><br></div><div>This patch adds the basic instrumentation functionality (w/o stack and global redzones) and one test.</div><div><br></div><div>If/when this patch is submitted, the following patches will follow:</div>

<div>  clang/driver support (flags, etc)</div><div>  stack/globals support</div><div>  run-time librrary </div><div>  integration tests</div><div><br></div><div>The patch file is attached, or it can be viewed at <a href="http://codereview.appspot.com/4867059/" target="_blank">http://codereview.appspot.com/4867059/</a></div>

<div><br></div><div>Thanks, </div><div><br></div><div>--kcc </div>