Commit Graph

1316 Commits

Author SHA1 Message Date
Alexey Samsonov 30c01f25f1 [Sanitizer] fix line width
llvm-svn: 165009
2012-10-02 14:09:20 +00:00
Alexey Samsonov 78c340d205 [ASan] Change __asan_set_on_error_callback to weak overridable __asan_on_error, so that ASan would call the latter even if it finds the error early (i.e. during module initialization)
llvm-svn: 165008
2012-10-02 14:06:39 +00:00
Evgeniy Stepanov 49e8576a09 [*San]: handle EINTR.
llvm-svn: 165006
2012-10-02 13:41:40 +00:00
Dmitry Vyukov 56faa551b9 tsan: fix mac build
llvm-svn: 165004
2012-10-02 12:58:14 +00:00
Alexey Samsonov 298e237d7e [ASan] Add extern C for __asan_symbolize on Windows
llvm-svn: 165003
2012-10-02 12:35:42 +00:00
Alexey Samsonov e29c6731aa [Sanitizer/ASan] Simplify the code that prints and symbolizes stack traces. Fall back to module+offset if user-provided symbolizer failed. Use weak function __asan_symbolize instead of __asan_set_symbolize_callback in ASan interface, so that we're able to symbolize reports for errors that happen before the main() is called, for example, during module initialization.
llvm-svn: 165000
2012-10-02 12:11:17 +00:00
Dmitry Vyukov a2c1c7a78e tsan: wait for pending reports before exit
llvm-svn: 164999
2012-10-02 12:07:16 +00:00
Dmitry Vyukov 27d5b37c38 tsan: output tid's in reports
llvm-svn: 164998
2012-10-02 11:52:05 +00:00
Dmitry Vyukov 0c40a5600c tsan: run output tests in parallel
llvm-svn: 164997
2012-10-02 11:51:40 +00:00
Bob Wilson dda435bcef Temporarily comment out some new arm variants to try to fix buildbots.
llvm-svn: 164909
2012-09-30 05:34:28 +00:00
Bob Wilson a4cefbdc87 Add compiler-rt support for Swift.
llvm-svn: 164903
2012-09-29 23:37:01 +00:00
Bob Wilson 0e039bee0d Add support for iOS6.
llvm-svn: 164902
2012-09-29 23:25:48 +00:00
Alexey Samsonov c3f61d8eec [ASan] Fix unit test headers. Add an option to change substitute asan_test_config.h file
llvm-svn: 164821
2012-09-28 12:24:23 +00:00
Alexey Samsonov 2d9899b2ce [ASan] use llvm-symbolizer (in offline mode) in ASan output tests on Linux
llvm-svn: 164819
2012-09-28 11:05:41 +00:00
Evgeniy Stepanov 9792396a06 [asan] Change defaults for Android target.
This way building without -DASAN_* in CFLAGS produces working binaries.

llvm-svn: 164816
2012-09-28 10:07:53 +00:00
Evgeniy Stepanov cb9cf0f907 Add a missing const qualifier.
llvm-svn: 164773
2012-09-27 13:21:08 +00:00
Evgeniy Stepanov f7f616ba66 Quick fix data/bss detection in TSan.
The old way breaks when a module's bss is adjacent to the [heap] vm area.
Both ways are not very reliable, though.

llvm-svn: 164772
2012-09-27 13:20:40 +00:00
Alexey Samsonov b6879ce94c [TSan] move replacement for new/delete back into tsan_interceptors
llvm-svn: 164764
2012-09-27 09:50:19 +00:00
Alexander Potapenko 3f6a5c1b2d Fixed a number of gpylint warnings, added binary names filtering (useful for Chrome), minor fixes.
llvm-svn: 164695
2012-09-26 13:16:42 +00:00
Alexander Potapenko 59cc8776c4 Encapsulate the main loop into a class to allow reusing it.
llvm-svn: 164694
2012-09-26 12:12:41 +00:00
Alexander Potapenko fa2a964540 Set --use-symbol-table=true as Alexey has already resolved the FIXME.
llvm-svn: 164693
2012-09-26 11:36:14 +00:00
Alexey Samsonov 789d4b2cd0 [TSan] fork external symbolizer before starting internal threads
llvm-svn: 164600
2012-09-25 12:35:47 +00:00
Alexey Samsonov 351d486df0 [TSan] one more attempt to fix sleep_sync test: call sleep in the spawned thread so that sleep-synchronization will be detected even if child thread is started late.
llvm-svn: 164488
2012-09-24 13:35:46 +00:00
Alexey Samsonov 313014694f [TSan] Provide replacements for operators new/delete instead of declaring extern C functions with weirdly mangled names (same strategy is used in ASan).
llvm-svn: 164487
2012-09-24 13:19:47 +00:00
Alexey Samsonov a555b3faf4 [ASan] Apply some ASan-relevant pieces of patch by Ruben Van Boxem. In the same time, remove ASan from CMake build on Windows after conversation with Timur. We don't want to support building ASan on Windows until it is in a working state.
llvm-svn: 164486
2012-09-24 11:43:40 +00:00
Alexey Samsonov 0659f72f7b [TSan] increase sleep time in test to ensure correct event ordering
llvm-svn: 164483
2012-09-24 08:57:41 +00:00
Michael J. Spencer c774095d44 [CMake][tsan] Compile .S files for tsan as C instead of CXX.
Using CXX breaks if you add -stdlib=libc++ to CMAKE_CXX_FLAGS.

llvm-svn: 164422
2012-09-21 22:39:39 +00:00
Alexey Samsonov 9e769a8d59 [Sanitizer] llvm-symbolizer: enable accessing symbol table (libObject is fixed in r164365) and replace string with std::string
llvm-svn: 164367
2012-09-21 10:54:14 +00:00
Eric Christopher 8539af7bbb Both OpenBSD and Bitrig need to include machine/endian.h to get the
_BYTE_ORDER define.

Patch by David Hill.

llvm-svn: 164286
2012-09-20 06:19:20 +00:00
Alexey Samsonov bc0b3f43d1 [ASan] Include ASan into CMake build only on Linux, Mac and Windows
llvm-svn: 164224
2012-09-19 14:15:30 +00:00
Alexey Samsonov 1fba97d22d [TSan] Add tsan to cmake build of compiler-rt only on Linux
llvm-svn: 164217
2012-09-19 13:11:13 +00:00
Alexey Samsonov ea2fb08545 [ASan] make asan_symbolize script work if there is no llvm-symbolizer available
llvm-svn: 164214
2012-09-19 11:43:41 +00:00
Alexey Samsonov 52565d5491 [ASan] fix offline python symbolizer script to use llvm-symbolizer if possible
llvm-svn: 164209
2012-09-19 08:49:53 +00:00
Alexey Samsonov 11b9e97cd9 [ASan] cleanup: fix headers and lint warnings
llvm-svn: 164205
2012-09-19 07:07:46 +00:00
Dmitry Vyukov 8d8639bc55 tsan: fix gcc4.2.1 warning
llvm-svn: 164200
2012-09-19 04:45:14 +00:00
Dmitry Vyukov c7bcaf8512 tsan: fix Go build
llvm-svn: 164198
2012-09-19 04:39:36 +00:00
Alexander Potapenko 431ea19327 Intercept signal() and sigaction() within the dynamic runtime on Mac.
Add a test that ensures that ASan does not allow to override the signal handlers.

llvm-svn: 164118
2012-09-18 12:49:51 +00:00
Alexey Samsonov 848abbd236 [TSan] s/uintptr_t/intptr_t in TSan test and enforce stack size limit in one of TSan output tests that somewhy fails otherwise
llvm-svn: 164116
2012-09-18 09:09:35 +00:00
Alexey Samsonov 3040830fcd [TSan] fix a typo in test dependencies. Silence few remaining pedantic gcc warnings in TSan tests.
llvm-svn: 164115
2012-09-18 08:33:37 +00:00
Alexey Samsonov 731219551e [Sanitizer] llvm-symbolizer: turn off symbol table lookup by default while getSymbolAddress from libObject returns wrong values
llvm-svn: 164113
2012-09-18 08:00:21 +00:00
Alexey Samsonov 8661465edd [ASan] Move printing descriptions of heap addresses in error report from allocator internals to asan_report.cc.
llvm-svn: 164112
2012-09-18 07:38:10 +00:00
Alexey Samsonov 5a42ac5b0e [Sanitizer] update lint checker script
llvm-svn: 164111
2012-09-18 07:26:51 +00:00
Alexey Samsonov 341e5bcb45 [TSan] port all output tests to lit and move them to lit_tests directory. This makes 'make check-tsan' command test both unit and output TSan tests. Old custom makefiles for running TSan tests are still functional as well.
llvm-svn: 164110
2012-09-18 07:23:54 +00:00
Kostya Serebryany 0a31ed1417 [tsan] fix the tsan allocator to handle any alignment
llvm-svn: 164107
2012-09-18 06:00:59 +00:00
Bill Wendling b556d5f13c Remove debugging code.
llvm-svn: 164052
2012-09-17 20:43:11 +00:00
Benjamin Kramer 7aa5b663ea Update linux stdio.h to support the recent additions to GCDAProfiling.
Hopefully unbreaks compiler-rt build on linux.

llvm-svn: 164025
2012-09-17 10:23:05 +00:00
Alexey Samsonov 0fa3ea69e2 [TSan] move: rtl_tests->tests/rtl unit_tests->tests/unit to make a single root for gtest-based tests. Support running these tests from lit via check-tsan command.
llvm-svn: 164022
2012-09-17 10:02:17 +00:00
Alexey Samsonov ff3f173e87 [TSan] If we detect an unlimited stack, try to re-exec with limited stack
llvm-svn: 164021
2012-09-17 09:14:11 +00:00
Alexey Samsonov 97ca306641 [Sanitizer] Hoist functions to get/set stack size and re-exec from memory-sanitizer branch to sanitizer_common
llvm-svn: 164020
2012-09-17 09:12:39 +00:00
Alexey Samsonov 3869b4b35a [ASan] increase sleep time if ASan finds two bugs simultaneously to make sure full error report is printed
llvm-svn: 164018
2012-09-17 08:02:19 +00:00
Dmitry Vyukov 40c19aaf84 tsan: increase internal memory block limit 1GB->4GB
llvm-svn: 164011
2012-09-17 03:18:45 +00:00
Dmitry Vyukov 4d743f5346 tsan: reserve msb in stack depot id's (required for msan)
llvm-svn: 164010
2012-09-17 03:14:15 +00:00
Bill Wendling 06fb5f0cc2 Remove unused variable.
llvm-svn: 163930
2012-09-14 20:23:31 +00:00
Bill Wendling 66429fe1c7 Add support for reading the GCDA file and merging the arc information.
With the advent of the __llvm_gcov_flush function, we need to be able to merge
counts into the .gcda files in an intelligent manner. This involves reading the
file if it exists, adding the counts together, and then writing the results.
<rdar://problem/12185886>

llvm-svn: 163923
2012-09-14 18:55:32 +00:00
Evgeniy Stepanov 6c0850afa4 Remove some debugging code.
llvm-svn: 163881
2012-09-14 08:57:50 +00:00
Kostya Serebryany 5b0a8f3f53 [asan] fix the va_arg usage
llvm-svn: 163879
2012-09-14 06:52:46 +00:00
Kostya Serebryany 45d849c4bd [asan] add asan option log_path=PATH to let users redirect asan reports to a file PATH.PID instead of stderr
llvm-svn: 163872
2012-09-14 04:35:14 +00:00
Alexey Samsonov 2b8de6a753 [TSan] support building TSan unittests in CMake
llvm-svn: 163797
2012-09-13 14:04:57 +00:00
Alexey Samsonov a7df554138 [TSan] fix a typo in CMakeLists
llvm-svn: 163796
2012-09-13 14:02:40 +00:00
Alexey Samsonov f0aa9148a2 [TSan] Use interface attribute for weak functions that may be overriden by user
llvm-svn: 163795
2012-09-13 13:34:09 +00:00
Alexey Samsonov 255f6a5f1a [TSan] Add initial support for buidling ThreadSanitizer runtime library with CMake (currently the only supported platfrom is 64-bit Linux). This patch makes 'clang++ -fthread-sanitizer' work for both clang in the build tree and installed clang
llvm-svn: 163789
2012-09-13 12:18:41 +00:00
Alexey Samsonov 046248c509 [TSan] fix a bunch of warnings reported by pedantic gcc
llvm-svn: 163788
2012-09-13 11:54:41 +00:00
Alexey Samsonov ddcb77f287 [Sanitizer] don't use -Werror as default compile flag for sanitizer runtimes - people may use too many distinct/old host compilers
llvm-svn: 163784
2012-09-13 10:23:45 +00:00
Alexander Potapenko c7a7522f83 Pass -std=c99 when compiling mach_override.c
llvm-svn: 163717
2012-09-12 15:44:56 +00:00
Alexander Potapenko f3a96894a6 Give more accurate malloc statistics to malloc_zone_statistics().
Fix a warning in macros instantiation.

llvm-svn: 163716
2012-09-12 15:29:50 +00:00
Alexander Potapenko dff254c534 Fix compiler warnings: remove __attribute__((visibility)) for static functions, use unsigned char instead of char.
llvm-svn: 163707
2012-09-12 14:14:08 +00:00
Alexey Samsonov 4787d0fbef [ASan] more macro/casting magic to suppress warnings
llvm-svn: 163706
2012-09-12 14:10:14 +00:00
Alexey Samsonov 26d7a06da3 [ASan] fix compiler warnings for unit test on Android
llvm-svn: 163704
2012-09-12 12:07:36 +00:00
Alexey Samsonov e413ad99ac [Sanitizer] Fix compiler warnings (including void* arithmetic) in mach_override
llvm-svn: 163698
2012-09-12 10:45:36 +00:00
Alexey Samsonov a81d268acd [ASan] fix interception macro for Android build
llvm-svn: 163692
2012-09-12 09:42:23 +00:00
Alexander Potapenko 814451909a Initial support for malloc_zone_statistics. All counters are set to zero now.
This is required to overcome a crash in mstats() (http://code.google.com/p/address-sanitizer/issues/detail?id=109)

llvm-svn: 163690
2012-09-12 09:38:51 +00:00
Alexey Samsonov 3d53c4ecf6 [Sanitizer] Please Android build. Re-check the availability of -Wno-variadic-macros flag.
llvm-svn: 163688
2012-09-12 08:06:15 +00:00
Alexey Samsonov 694633e19b [Sanitizer] first effort to start building ASan runtime with -Werror in CMake build
llvm-svn: 163686
2012-09-12 07:38:47 +00:00
Alexey Samsonov 788eaeb35b [Sanitizer] get rid of empty DEFAULT_CONVENTION in interception lib to remove empty macro arguments
llvm-svn: 163622
2012-09-11 15:02:20 +00:00
Alexey Samsonov 100150f59d [Sanitizer] test 64-bit allocator only on suitable targets
llvm-svn: 163615
2012-09-11 12:19:18 +00:00
Alexander Potapenko ab7a4ea485 Revert the lockf() support.
llvm-svn: 163614
2012-09-11 11:59:05 +00:00
Evgeniy Stepanov 1a8f8fa6c0 CMake build rules for ASan Android runtime and tests.
llvm-svn: 163613
2012-09-11 11:55:45 +00:00
Evgeniy Stepanov af0f6c8991 Fox a typo.
llvm-svn: 163611
2012-09-11 11:35:18 +00:00
Alexey Samsonov 894069796e [Sanitizer] Add new lit testsuite: check-sanitizer that runs unit tests for sanitizer_common runtime (shared between ASan and TSan)
llvm-svn: 163610
2012-09-11 10:50:32 +00:00
Alexey Samsonov c21f901b2f [Sanitizer] fix warnings reported by gcc. Update the list of targets to check lint for
llvm-svn: 163608
2012-09-11 10:31:28 +00:00
Alexey Samsonov eeec3c11b5 [compiler-rt] Install support for CMake build of compiler-rt
llvm-svn: 163607
2012-09-11 10:26:54 +00:00
Alexey Samsonov fcbc97a13f [Sanitizer] remove custom Die/CheckFailed from allocator testlib
llvm-svn: 163604
2012-09-11 09:48:52 +00:00
Alexey Samsonov 5c6b93bc33 [Sanitizer] Get rid of dependency between sanitizer_common and asan/tsan runtimes: implement tool-specific Die and CheckFailed functions via callbacks
llvm-svn: 163603
2012-09-11 09:44:48 +00:00
Alexander Potapenko 1a471772b0 Interceptors for lockf and lockf64, minor calloc() fix.
llvm-svn: 163602
2012-09-11 09:26:35 +00:00
Chandler Carruth b156b56a28 Revert r163411 based on review discussion.
In code review, it looked like these warnings do not actually fire with
modern Clang or GCC. However, the pragma is flat out rejected by GCC in
many configurations (-Werror) so it ended up causing more problems than
it fixed.

Daniel agreed with reverting this, but I think didn't have time to get
to it.

llvm-svn: 163583
2012-09-11 01:13:51 +00:00
Daniel Dunbar 256ea4e4f3 build/clang_darwin: Add the ASAN dynamic library.
- Now with spelling fix for -lstdc++.

llvm-svn: 163527
2012-09-10 18:26:38 +00:00
Chad Rosier ca8b950317 Revert r163415 in an attempt to bring back the buildbots.
llvm-svn: 163522
2012-09-10 17:26:42 +00:00
Evgeniy Stepanov 6f66ed1329 [asan] There is no __libc_malloc on Android.
llvm-svn: 163498
2012-09-10 10:18:49 +00:00
Alexander Potapenko 67192d41ee Allow to call strchr() from __asan_init().
Fixes PR13794.

llvm-svn: 163493
2012-09-10 08:35:12 +00:00
Daniel Dunbar 6eae4ce2b8 build/clang_darwin: Add the ASAN dynamic library.
llvm-svn: 163415
2012-09-07 19:57:35 +00:00
Daniel Dunbar 9d098bc09a [asan] Use a relative include path instead of requiring build system involvement.
llvm-svn: 163414
2012-09-07 19:57:32 +00:00
Daniel Dunbar 44b3474b0e build: Teach Makefile build system about asan/dynamic subdir.
llvm-svn: 163413
2012-09-07 19:57:28 +00:00
Daniel Dunbar c053c2bcda build: Add support for building dylibs.
llvm-svn: 163412
2012-09-07 19:57:23 +00:00
Daniel Dunbar 04ab17b0cd [asan] Suppress some bogus -Winvalid-noreturn diagnostics.
llvm-svn: 163411
2012-09-07 19:57:20 +00:00
Dmitry Vyukov 7ea4c2ccfb tsan: ignore destruction of global mutexes (causes a lot of non-interesting reports)
llvm-svn: 163400
2012-09-07 18:08:02 +00:00
Alexander Potapenko 38c3f9ef2f Remove the infinite recursion check for now, as we don't have __thread on Mac, and TSD is an overkill.
llvm-svn: 163393
2012-09-07 15:50:19 +00:00
Alexander Potapenko c5adb8a700 Two minor changes:
-- exit from infinite recursion in CHECK()
 -- print a verbose message if mapping of the shadow memory has failed.

llvm-svn: 163391
2012-09-07 15:34:40 +00:00
Evgeniy Stepanov 6e6817a823 [asan] Raise quarantine size a bit with ASAN_LOW_MEMORY.
Our tests expect that a 16M block will fit in the quarantine.

llvm-svn: 163384
2012-09-07 12:13:52 +00:00
Alexey Samsonov f42e860c51 [ASan] hack initialization-bug test so that it stably passes on both Linux and Mac: make the bug appear independent of the translation unit order
llvm-svn: 163381
2012-09-07 09:24:29 +00:00
Alexey Samsonov 0f5f1d5bfa [ASan] add Linux-specific test for initialization order that checks that we find a bug independently of translation units order
llvm-svn: 163379
2012-09-07 09:04:31 +00:00
Alexey Samsonov cd66d97799 [Sanitizer] add --demangle option to llvm-symbolizer (for now just assume that __cxa_demangle option is available)
llvm-svn: 163376
2012-09-07 07:26:35 +00:00
Dmitry Vyukov 23ecb4acd9 tsan: fix code style
llvm-svn: 163326
2012-09-06 16:11:30 +00:00
Dmitry Vyukov c87e7280b8 tsan: increase max shadow stack size + reduce memory consumption at the same time (by not memorizing full stacks in traces)
llvm-svn: 163322
2012-09-06 15:18:14 +00:00
Dmitry Vyukov 50d49238a6 tsan: fix Go build script
llvm-svn: 163320
2012-09-06 15:10:19 +00:00
Alexander Potapenko 35bc23ce58 Fix two compiler warnings: must use at least one argument for "..." in a variadic macros, signed vs. unsigned comparison.
llvm-svn: 163314
2012-09-06 13:31:13 +00:00
Evgeniy Stepanov 65fb0a5425 [asan] Use __ANDROID__ guard in asan_test.
llvm-svn: 163313
2012-09-06 12:50:28 +00:00
Alexander Potapenko 3ecf916c33 Use the return value of dladdr() to avoid Clang warning.
llvm-svn: 163311
2012-09-06 12:18:45 +00:00
Kostya Serebryany f9caa28ccf [asan] increase max stack size to 256 (+test)
llvm-svn: 163308
2012-09-06 10:57:03 +00:00
Alexander Potapenko 447ff70280 Add "movsbl %dh, %ecx" and "testb %r8, %r8" to mach_override.
This should fix http://code.google.com/p/address-sanitizer/issues/detail?id=105

llvm-svn: 163301
2012-09-06 09:38:27 +00:00
Alexey Samsonov 36853a7a3b [ASan] actually remove old makefile
llvm-svn: 163300
2012-09-06 09:30:09 +00:00
Alexey Samsonov fdff4a8e0b [TSan] add support for running external symbolizer other than addr2line (for testing purposes)
llvm-svn: 163297
2012-09-06 08:48:43 +00:00
Alexey Samsonov 3ebf2fa654 [Sanitizer] remove unused field
llvm-svn: 163296
2012-09-06 08:47:38 +00:00
Alexey Samsonov ac87a5bddc [ASan] Nuke output_tests/ in favor of lit_tests/. Stop using Makefile.old.
llvm-svn: 163294
2012-09-06 06:39:02 +00:00
Kostya Serebryany ae350f66d4 [asan] increase the maximal size of malloc/free stack
llvm-svn: 163291
2012-09-06 04:46:47 +00:00
Alexey Samsonov f6d2125829 [Sanitizer] implement readlink as syscall on Linux
llvm-svn: 163213
2012-09-05 14:48:24 +00:00
Alexey Samsonov 2947b84743 [ASan] Hack ASan lit config to allow running lit on tests manually
llvm-svn: 163209
2012-09-05 10:41:25 +00:00
Kostya Serebryany 4d45b9b784 [asan] added tests for asan-initialization-order, patch by Reid Watson
llvm-svn: 163207
2012-09-05 09:07:02 +00:00
Alexey Samsonov d83ccd067d [ASan] hoist more compile flags to SANITIZER_COMMON_CFLAGS var and add the rest of flags/defs from old Makefile to CMake
llvm-svn: 163204
2012-09-05 09:00:03 +00:00
Alexey Samsonov ab2c76711d [ASan] Add CMake support for building ASan benchmarks
llvm-svn: 163201
2012-09-05 08:07:18 +00:00
Alexey Samsonov c402cb62fd [ASan] Add print_full_thread_history runtime option (on by default) that prints all full thread creation paths for threads involved in ASan error report
llvm-svn: 163200
2012-09-05 07:37:15 +00:00
Alexey Samsonov ceffb021c5 [Sanitizer] Remove implicit conversion of InternalScopedBuffer<T> to T*
llvm-svn: 163197
2012-09-05 07:23:44 +00:00
Alexey Samsonov 6f696f4d17 [Sanitizer] Support for reading inlined frames from llvm-symbolizer
llvm-svn: 163140
2012-09-04 15:34:43 +00:00
Alexey Samsonov f2ce35fc30 [compiler-rt] Recurse into 'utils' directory in CMake build of compiler-rt, enable build of llvm-symbolizer binary (currently for one target only)
llvm-svn: 163138
2012-09-04 14:52:21 +00:00
Alexey Samsonov 0342b473b1 [Sanitizer] llvm-symbolizer util: make it more conforming to LLVM code style, and support fetching inlining info
llvm-svn: 163133
2012-09-04 11:42:07 +00:00
Dmitry Vyukov 49dd68ae7c tsan: do not crash with obscure message if a user passes invalid arguments to malloc/free/memset/etc
llvm-svn: 163092
2012-09-02 12:04:51 +00:00
Dmitry Vyukov b7f1852140 tsan: insert cfi directives into assembly (not fully working for now, though)
llvm-svn: 163090
2012-09-02 11:24:07 +00:00
Dmitry Vyukov 72cddf33d9 tsan: more robust current thread stack restoration
llvm-svn: 163089
2012-09-02 11:23:39 +00:00
Dmitry Vyukov 46ca1fb404 tsan: better diagnostics for mutex misuse
llvm-svn: 163060
2012-09-01 12:13:18 +00:00
Dmitry Vyukov cbc303006c tsan: fix crash when users pass insane mutex addresses in dynamic annotations
llvm-svn: 163016
2012-08-31 20:02:33 +00:00
Dmitry Vyukov 318f77749e tsan: add "as if synchronized via sleep" feature
llvm-svn: 163006
2012-08-31 17:27:49 +00:00
Dmitry Vyukov 179e5ddae1 tsan: fix windows build (2)
llvm-svn: 162997
2012-08-31 14:11:33 +00:00
Dmitry Vyukov fa90fa357e tsan: fix windows build (1)
llvm-svn: 162996
2012-08-31 14:01:33 +00:00
Dmitry Vyukov bead8f1e3f tsan: slightly optimize mutex unlock
llvm-svn: 162995
2012-08-31 13:42:28 +00:00
Dmitry Vyukov 6f6ba43271 tsan: more precise handling of atomic_store(memory_order_release)
llvm-svn: 162994
2012-08-31 13:22:13 +00:00
Dmitry Vyukov ef8d1944b8 tsan: improve stack depot
llvm-svn: 162993
2012-08-31 12:47:44 +00:00
Kostya Serebryany d19c8cb2cc [tsan] locate the auxilary space for tsan's Allocator64 after the main region, not before. This simplifies the shadow mappings
llvm-svn: 162991
2012-08-31 12:41:00 +00:00
Alexey Samsonov 3222dad6e3 [Sanitizer] fix overloaded operator error
llvm-svn: 162990
2012-08-31 11:43:01 +00:00
Alexey Samsonov fd0a6e6030 [compiler-rt] fixup for r162988 - remove accidentally commited file
llvm-svn: 162989
2012-08-31 11:13:38 +00:00
Alexey Samsonov 704f71616d [compiler-rt] Move draft code for llvm-symbolizer to compiler-rt/utils/llvm-symbolizer after chandlerc's suggestion
llvm-svn: 162988
2012-08-31 11:12:10 +00:00
Alexey Samsonov e70ed73d1f [Sanitizer] Remove some calls to libc malloc from symbolizer
llvm-svn: 162987
2012-08-31 11:07:52 +00:00
Alexey Samsonov 329eae86ef [Sanitizer] Resolve fixme: break dependency of sanitizer_common tests on TSan RTL
llvm-svn: 162984
2012-08-31 10:15:44 +00:00
Alexey Samsonov 79b36285ca [Sanitizer] Make lint checking a standalone script in sanitizer_common
llvm-svn: 162982
2012-08-31 08:36:36 +00:00
Alexey Samsonov de827cb42b [Sanitizer] Remove lint checkers from our old makefiles in favor of buildbot
llvm-svn: 162981
2012-08-31 08:10:28 +00:00
Alexey Samsonov 66ca36a564 [TSan] Fix style warinings in output test
llvm-svn: 162980
2012-08-31 08:00:37 +00:00
Alexey Samsonov c3a8119a41 Whitespace/lint
llvm-svn: 162909
2012-08-30 14:22:21 +00:00
Dmitry Vyukov b244c46c66 tsan: speed up allocator64 GetBlockBegin()
llvm-svn: 162908
2012-08-30 13:55:43 +00:00
Dmitry Vyukov 7af8a3a83d tsan: simplify TSAN_HISTORY_SIZE code
llvm-svn: 162905
2012-08-30 13:29:11 +00:00
Dmitry Vyukov 191f2f7cdb tsan: use stack depot to describe heap blocks
llvm-svn: 162902
2012-08-30 13:02:30 +00:00
Dmitry Vyukov f4792878c4 asan/tsan: first version of "stack depot"
llvm-svn: 162897
2012-08-30 10:02:48 +00:00
Alexey Samsonov 608a4b5def [ASan] fix flakiness of Linux-specific clone_test: waitpid should better be provided with __WCLONE option, otherwise it didn't wait for the subprocess, returned -1, and we went crushing the subprocess stack
llvm-svn: 162842
2012-08-29 15:48:14 +00:00
Alexander Potapenko 5a9b616d6b For invalid pointers passed to free_common check whether they are actually skewed to hold an additional CFAllocatorRef.
If so, fix the pointer and pass it to asan_free.

See http://code.google.com/p/address-sanitizer/issues/detail?id=70 for more background.

llvm-svn: 162839
2012-08-29 12:36:24 +00:00
Kostya Serebryany d0d96bfb86 [asan/tsan] use InternalScopedBuffer instead of stack arrays. Use mmap inseted of InternalAlloc in InternalScopedBuffer
llvm-svn: 162834
2012-08-29 08:40:36 +00:00
Kostya Serebryany 4310fe35ea [tsan] fix tsan's Makefile.old -- our build bot still uses it (hopefully, will soon migrate to cmake completely)
llvm-svn: 162832
2012-08-29 08:21:09 +00:00
Kostya Serebryany e4d9c7b940 [asan] fix asan's Makefile.old -- our build bot still uses it (hopefully, will soon migrate to cmake completely)
llvm-svn: 162831
2012-08-29 08:06:27 +00:00
Chandler Carruth 1aa4fef601 Relocate the external headers provided by ASan and the common sanitizer
library.

These headers are intended to be available to user code when built with
AddressSanitizer (or one of the other sanitizer's in the future) to
interface with the runtime library. As such, they form stable external
C interfaces, and the headers shouldn't be located within the
implementation.

I've pulled them out into what seem like fairly obvious locations and
names, but I'm wide open to further bikeshedding of these names and
locations.

I've updated the code and the build system to cope with the new
locations, both CMake and Makefile. Please let me know if this breaks
anyone's build.

The eventual goal is to install these headers along side the Clang
builtin headers when we build the ASan runtime and install it. My
current thinking is to locate them at:

  <prefix>/lib/clang/X.Y/include/sanitizer/common_interface_defs.h
  <prefix>/lib/clang/X.Y/include/sanitizer/asan_interface.h
  <prefix>/lib/clang/X.Y/include/sanitizer/...

But maybe others have different suggestions?

Fixing the style of the #include between these headers at least unblocks
experimentation with installing them as they now should work when
installed in these locations.

llvm-svn: 162822
2012-08-29 02:27:54 +00:00
Chandler Carruth c1c9d5818f Some flag cleanup for the sanitizer runtimes.
This hoists most of the CFLAGS into a common variable. It also adds
detection for -Wno-c99-extensions and uses it to silence a pile of
warnings.

Finally, it switches to the proper flag -rdynamic.

With this, the cmake build is warning free on my bootstrap Linux build.

llvm-svn: 162809
2012-08-29 00:13:11 +00:00
Kostya Serebryany 66a37f3aef [asan] one more fix for windows build
llvm-svn: 162762
2012-08-28 15:25:07 +00:00
Kostya Serebryany 3a6af66a0e [asan] fix the cmake build (hopefully)
llvm-svn: 162760
2012-08-28 14:48:28 +00:00
Kostya Serebryany 327d0a5666 [asan] actually doing 'svn add' helps
llvm-svn: 162759
2012-08-28 14:27:06 +00:00
Kostya Serebryany 27dcb2379f [asan] fix Windows build
llvm-svn: 162758
2012-08-28 14:14:30 +00:00
Kostya Serebryany 7575968aa4 [asan] actually move StackTrace to sanitizer_common
llvm-svn: 162757
2012-08-28 14:11:57 +00:00
Kostya Serebryany a57b4e823a [asan] even more refactoring to move StackTrace to sanitizer_common
llvm-svn: 162754
2012-08-28 13:49:49 +00:00
Kostya Serebryany ee92877f17 [asan] more refactoring to move StackTrace to sanitizer_common
llvm-svn: 162752
2012-08-28 13:25:55 +00:00
Alexey Samsonov 50e8a6a7df [ASan] CMake build: share more compile flags between instrumented and non-instrumented tests
llvm-svn: 162750
2012-08-28 12:38:17 +00:00
Kostya Serebryany ccc470c499 [asan] some renaming before we move StackTrace into sanitizer_common (part 2)
llvm-svn: 162748
2012-08-28 11:54:51 +00:00
Kostya Serebryany 6b0d775229 [asan] some renaming before we move StackTrace into sanitizer_common
llvm-svn: 162747
2012-08-28 11:54:30 +00:00
Kostya Serebryany bb6f165952 [asan] get rid of AsanPrintf in favor of Printf from sanitizer_common
llvm-svn: 162746
2012-08-28 11:34:40 +00:00
Kostya Serebryany 4bfe954d14 [asan] improve SetErrorReportCallbackTest to actually catch missing functionality in __asan_set_error_report_callback
llvm-svn: 162745
2012-08-28 11:21:01 +00:00
Alexey Samsonov 384de7c9c9 [Sanitizer] Allow to create stub MemoryMappingLayout on Windows
llvm-svn: 162742
2012-08-28 08:27:08 +00:00
Alexey Samsonov cae486c063 [Sanitizer] One more method stub for Windows
llvm-svn: 162739
2012-08-28 07:22:24 +00:00
Alexey Samsonov d1d1a814b7 [Sanitizer] align allocation sizes in low level allocator
llvm-svn: 162676
2012-08-27 14:51:36 +00:00
Evgeniy Stepanov f72f08affc CMake build rules for ASan/Android runtime.
llvm-svn: 162675
2012-08-27 14:28:27 +00:00
Alexey Samsonov 28d8be2d86 [Sanitizer] One more try to fix Windows build
llvm-svn: 162674
2012-08-27 14:08:53 +00:00
Alexey Samsonov e67a5dd8e1 [Sanitizer] Use low-level allocator in flag parsing to avoid calling malloc() before ASan/TSan initialization is done
llvm-svn: 162673
2012-08-27 14:04:54 +00:00
Alexey Samsonov cc62211fbf [Sanitizer] Rename ProcessMaps to MemoryMappingLayout and fix Windows build by providing stub implementation
llvm-svn: 162671
2012-08-27 13:48:48 +00:00
Alexey Samsonov c74289db2b [ASan] add missing build dependency on sanitizer_common headers
llvm-svn: 162670
2012-08-27 13:47:28 +00:00
Evgeniy Stepanov be01398612 A few tweaks for building ASanRT against Android NDK.
llvm-svn: 162666
2012-08-27 11:15:55 +00:00
Alexey Samsonov dc8d1f1039 [Sanitizer] move low-level (mmap-based) allocator to sanitizer_common
llvm-svn: 162663
2012-08-27 09:30:58 +00:00
Dmitry Vyukov 7d3d94454c tsan: improve memory allocator a bit
llvm-svn: 162561
2012-08-24 15:53:14 +00:00
Alexander Potapenko 00492cab3e Revert the erroneous changes made to Makefile.old in r162547
Remove a spare newline from asan_rtl.cc

llvm-svn: 162548
2012-08-24 09:31:53 +00:00
Alexander Potapenko fefc1e989c If the program is linked to a dynamic ASan runtime which is not present in DYLD_INSERT_LIBRARIES
(which, in turn, is required for our interceptors to take effect), re-exec the program with
DYLD_INSERT_LIBRARIES set.

llvm-svn: 162547
2012-08-24 09:22:05 +00:00
Alexander Potapenko d79d80b4a0 Add add_clang_runtime_shared_library() CMake function and use it to put the shared ASan runtime in the appropriate place.
llvm-svn: 162546
2012-08-24 07:49:22 +00:00
Dmitry Vyukov 0481ae4722 tsan: allow to override per-thread event trace size
useful if you don't see the second stack trace

llvm-svn: 162456
2012-08-23 18:26:03 +00:00
Dmitry Vyukov 7e6347402d tsan: fix new memory allocator
Deallocate: drain blocks to central cache if cached too much (instead of never drain).
Allocate: batch allocate fixed amount of blocks (instead of all blocks).
This significantly reduces memory consumption of large heavy-multithreaded programs.

llvm-svn: 162447
2012-08-23 17:16:07 +00:00
Alexey Samsonov 563fb4113c [Sanitizer] Add external symbolizer binary. Next steps - include it in CMake build (produce 32-bit and 64-bit version of it, make sure we can compile LLVM sources with our own flags) and add tests for it.
llvm-svn: 162442
2012-08-23 12:39:35 +00:00
Alexander Potapenko 2ebe619340 Re-implement the wrappers for libdispatch functions using blocks where appropriate
(kudos to Anna Zaks for a good example).
This simplifies the code much and lets us not implement internal parts of libdispatch.

All ASan tests from t32 and t64 should pass with the dylib runtime now.

llvm-svn: 162439
2012-08-23 09:34:40 +00:00
Alexey Samsonov 419f610a74 [Sanitizer] Switch the symbolization strategy that would be used by sanitizer tools family: as compiling in-process symbolizer into runtime involves certain difficulties, we may instead launch an external symbolizer program (fork + execl) in a subprocess and communicate with it via pipe.
llvm-svn: 162437
2012-08-23 07:32:06 +00:00
Alexey Samsonov 4d520640ba [ASan] use write instead of puts in malloc hooks test for ASan, as puts calls malloc on Mac
llvm-svn: 162359
2012-08-22 13:32:37 +00:00
Alexey Samsonov a85b6b8154 [ASan] get rid of ASAN_USE_EXTERNAL_SYMBOLIZER compiler def in favor of __asan_set_symbolize_callback interface function. Now the user doesn't have to recompile ASan runtime to provide its own symbolizer
llvm-svn: 162358
2012-08-22 13:31:37 +00:00
Alexey Samsonov de17f86655 [ASan] make ASan malloc/free hooks weak interface functions, overridable by user. Now the user can control malloc/free hooks without recompiling ASan runtime
llvm-svn: 162355
2012-08-22 10:12:47 +00:00
Alexey Samsonov 9b4e440c44 [ASan] fix CMake build: make sure that all ASan runtimes are built at correct directory
llvm-svn: 162353
2012-08-22 09:19:32 +00:00
Alexey Samsonov 75e5fc3e57 [TSan] switch tsan to using InternalScopedBuffer from sanitizer_common
llvm-svn: 162351
2012-08-22 07:25:52 +00:00
Kostya Serebryany 68d9c9da40 [asan] fix mac build
llvm-svn: 162279
2012-08-21 14:43:36 +00:00
Kostya Serebryany 676bcdb838 [asan] run-time part of the initialization order checker. Patch by Reid Watson with some bits from kcc. The sub-pass is off by default for now. On simple tests it works fine.
llvm-svn: 162278
2012-08-21 14:10:25 +00:00
Alexey Samsonov b92488a549 [Sanitizer] implement internal_strcspn
llvm-svn: 162272
2012-08-21 09:26:26 +00:00
Kostya Serebryany 55b4dd314f [asan] update asan-rt to match the interface change in LLVm (r162268)
llvm-svn: 162269
2012-08-21 08:24:35 +00:00
Alexey Samsonov e6704ee109 [Sanitizer] define InternalScopedBuffer to replace large arrays on stack. It is defined analogous to similar class in tsan and should replace it.
llvm-svn: 162262
2012-08-21 08:13:37 +00:00
Kostya Serebryany 6b745b5281 [asan] fix lint
llvm-svn: 162258
2012-08-21 06:43:44 +00:00
Alexander Potapenko 02e6f03236 Dynamic interceptors for dispatch_async and dispatch_after.
llvm-svn: 162202
2012-08-20 11:59:26 +00:00
Alexander Potapenko 1233d558dc Minor refactoring: reduce code duplication by introducing a macro for dispatch_sync_f, dispatch_async_f, dispatch_barrier_async_f bodies.
llvm-svn: 162199
2012-08-20 09:25:10 +00:00