summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Potapenko <glider@google.com>2014-04-17 17:29:07 +0000
committerAlexander Potapenko <glider@google.com>2014-04-17 17:29:07 +0000
commitda1c510ea6116060bccfde5728cdb9fb137a2c36 (patch)
tree84b72e85de22634a9bd128d76b744ad6ca33b2c1
parentc71e7bc4152e0113bb1af65da025544172bb8e78 (diff)
downloadbcm5719-llvm-da1c510ea6116060bccfde5728cdb9fb137a2c36.tar.gz
bcm5719-llvm-da1c510ea6116060bccfde5728cdb9fb137a2c36.zip
[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. llvm-svn: 206477
-rw-r--r--compiler-rt/lib/asan/tests/asan_noinst_test.cc13
1 files changed, 11 insertions, 2 deletions
diff --git a/compiler-rt/lib/asan/tests/asan_noinst_test.cc b/compiler-rt/lib/asan/tests/asan_noinst_test.cc
index ea1dd4aaace..52254f1c611 100644
--- a/compiler-rt/lib/asan/tests/asan_noinst_test.cc
+++ b/compiler-rt/lib/asan/tests/asan_noinst_test.cc
@@ -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, LoadStoreCallbacks) {
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, LoadStoreCallbacks) {
}
}
}
- delete [] ptr;
+ __asan::asan_free(ptr, &stack, __asan::FROM_MALLOC);
}
__asan_test_only_reported_buggy_pointer = 0;
}
OpenPOWER on IntegriCloud