[compiler-rt] r206477 - [ASan] Change AddressSanitizer.LoadStoreCallbacks to use asan_malloc and asan_free.
Kostya Serebryany
kcc at google.com
Thu Apr 17 10:44:08 PDT 2014
thanks! (ouch!)
On Thu, Apr 17, 2014 at 9:29 PM, Alexander Potapenko <glider at google.com>wrote:
> Author: glider
> Date: Thu Apr 17 12:29:07 2014
> New Revision: 206477
>
> URL: http://llvm.org/viewvc/llvm-project?rev=206477&view=rev
> Log:
> [ASan] Change AddressSanitizer.LoadStoreCallbacks to use asan_malloc and
> asan_free.
> Interceptors don't really work on OSX in asan_noinst_test.cc (this is more
> or less intentional),
> so one shouldn't call intercepted functions in this test -- added a
> comment about this.
>
> Modified:
> compiler-rt/trunk/lib/asan/tests/asan_noinst_test.cc
>
> Modified: compiler-rt/trunk/lib/asan/tests/asan_noinst_test.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/asan_noinst_test.cc?rev=206477&r1=206476&r2=206477&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/asan/tests/asan_noinst_test.cc (original)
> +++ compiler-rt/trunk/lib/asan/tests/asan_noinst_test.cc Thu Apr 17
> 12:29:07 2014
> @@ -25,6 +25,11 @@
> #include <vector>
> #include <limits>
>
> +// ATTENTION!
> +// Please don't call intercepted functions (including malloc() and
> friends)
> +// in this test. The static runtime library is linked explicitly (without
> +// -fsanitize=address), thus the interceptors do not work correctly on OS
> X.
> +
> extern "C" {
> // Set specific ASan options for uninstrumented unittest.
> const char* __asan_default_options() {
> @@ -233,8 +238,12 @@ TEST(AddressSanitizer, LoadStoreCallback
> uptr buggy_ptr;
>
> __asan_test_only_reported_buggy_pointer = &buggy_ptr;
> + StackTrace stack;
> + stack.trace[0] = 0x890;
> + stack.size = 1;
> +
> for (uptr len = 16; len <= 32; len++) {
> - char *ptr = new char[len];
> + char *ptr = (char*) __asan::asan_malloc(len, &stack);
> uptr p = reinterpret_cast<uptr>(ptr);
> for (uptr is_write = 0; is_write <= 1; is_write++) {
> for (uptr size_log = 0; size_log <= 4; size_log++) {
> @@ -251,7 +260,7 @@ TEST(AddressSanitizer, LoadStoreCallback
> }
> }
> }
> - delete [] ptr;
> + __asan::asan_free(ptr, &stack, __asan::FROM_MALLOC);
> }
> __asan_test_only_reported_buggy_pointer = 0;
> }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140417/a20a6d70/attachment.html>
More information about the llvm-commits
mailing list