[compiler-rt] r174626 - [ASan] Enable the new and delete wrappers on Darwin.
Alexander Potapenko
glider at google.com
Thu Feb 7 07:33:56 PST 2013
Author: glider
Date: Thu Feb 7 09:33:56 2013
New Revision: 174626
URL: http://llvm.org/viewvc/llvm-project?rev=174626&view=rev
Log:
[ASan] Enable the new and delete wrappers on Darwin.
Also fix large_func_test.cc, which got broken when we switched to allocator2: the OOB access was too far from the original allocation, so ASan decided to describe the next one.
Modified:
compiler-rt/trunk/lib/asan/asan_new_delete.cc
compiler-rt/trunk/lib/asan/lit_tests/large_func_test.cc
Modified: compiler-rt/trunk/lib/asan/asan_new_delete.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_new_delete.cc?rev=174626&r1=174625&r2=174626&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_new_delete.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_new_delete.cc Thu Feb 7 09:33:56 2013
@@ -27,9 +27,9 @@ void ReplaceOperatorsNewAndDelete() { }
using namespace __asan; // NOLINT
-// On Mac and Android new() goes through malloc interceptors.
+// On Android new() goes through malloc interceptors.
// See also https://code.google.com/p/address-sanitizer/issues/detail?id=131.
-#if !ASAN_ANDROID && !ASAN_MAC
+#if !ASAN_ANDROID
// Fake std::nothrow_t to avoid including <new>.
namespace std {
Modified: compiler-rt/trunk/lib/asan/lit_tests/large_func_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/lit_tests/large_func_test.cc?rev=174626&r1=174625&r2=174626&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/lit_tests/large_func_test.cc (original)
+++ compiler-rt/trunk/lib/asan/lit_tests/large_func_test.cc Thu Feb 7 09:33:56 2013
@@ -32,7 +32,7 @@ static void LargeFunction(int *x, int ze
// CHECK: {{.*ERROR: AddressSanitizer: heap-buffer-overflow on address}}
// CHECK: {{0x.* at pc 0x.* bp 0x.* sp 0x.*}}
// CHECK: {{READ of size 4 at 0x.* thread T0}}
- x[zero + 111]++; // we should report this exact line
+ x[zero + 103]++; // we should report this exact line
// atos incorrectly extracts the symbol name for the static functions on
// Darwin.
// CHECK-Linux: {{#0 0x.* in LargeFunction.*large_func_test.cc:}}[[@LINE-3]]
@@ -54,14 +54,9 @@ int main(int argc, char **argv) {
int *x = new int[100];
LargeFunction(x, argc - 1);
// CHECK: {{ #1 0x.* in _?main .*large_func_test.cc:}}[[@LINE-1]]
- // CHECK: {{0x.* is located 44 bytes to the right of 400-byte region}}
+ // CHECK: {{0x.* is located 12 bytes to the right of 400-byte region}}
// CHECK: {{allocated by thread T0 here:}}
- // CHECK-Linux: {{ #0 0x.* in operator new.*}}
- // CHECK-Linux: {{ #1 0x.* in _?main .*large_func_test.cc:}}[[@LINE-6]]
-
- // CHECK-Darwin: {{ #0 0x.* in _?wrap_malloc.*}}
- // CHECK-Darwin: {{ #1 0x.* in operator new.*}}
- // CHECK-Darwin: {{ #2 0x.* in operator new\[\].*}}
- // CHECK-Darwin: {{ #3 0x.* in _?main .*large_func_test.cc:}}[[@LINE-11]]
+ // CHECK: {{ #0 0x.* in operator new.*}}
+ // CHECK: {{ #1 0x.* in _?main .*large_func_test.cc:}}[[@LINE-6]]
delete x;
}
More information about the llvm-commits
mailing list