Commit Graph

1099 Commits

Author SHA1 Message Date
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
Alexander Potapenko 4a156c1b80 Fix a leftover #if defined(DYNAMIC_MAC_WRAPPERS).
llvm-svn: 162197
2012-08-20 08:49:49 +00:00
Dmitry Vyukov e59bed4e8a tsan: proper handling of linker initialized mutexes
llvm-svn: 162169
2012-08-18 11:49:00 +00:00
Dmitry Vyukov e2b5b5c4ac tsan: Non-executable stack for hand-coded assembly
llvm-svn: 162112
2012-08-17 18:05:28 +00:00
Alexander Potapenko dffbb3b330 Intercept siglongjmp and _longjmp under "#if ASAN_INTERCEPT_*"
llvm-svn: 162103
2012-08-17 16:27:38 +00:00
Alexander Potapenko 5f487de8a3 Fix lint warnings.
llvm-svn: 162092
2012-08-17 10:08:51 +00:00
Alexander Potapenko c62210e3ff Commit the source and CMake changes that will allow to build ASan runtime
as a shared library on Mac OS. This will provide an alternative to
mach_override.

llvm-svn: 162091
2012-08-17 09:00:08 +00:00
Dmitry Vyukov 9f143c5c5f tsan: improve Go report format + fix build
llvm-svn: 162042
2012-08-16 19:36:45 +00:00
Dmitry Vyukov 77196efb1e tsan: add flag to disable reporting of destruction of locked mutexes (some programs use that on a regular basis)
llvm-svn: 162024
2012-08-16 15:12:35 +00:00
Dmitry Vyukov 3482ec3bc8 tsan: better diagnostics for destroy of a locked mutex + a test
llvm-svn: 162022
2012-08-16 15:08:49 +00:00
Dmitry Vyukov 19ae9f3b2e tsan: support for linker initializer mutexes with static storage duration
llvm-svn: 162021
2012-08-16 14:21:09 +00:00
Dmitry Vyukov 5c45dab649 tsan: fix COMPAT shadow mapping once again
llvm-svn: 162020
2012-08-16 14:20:45 +00:00
Dmitry Vyukov 4723e6b1e5 tsan: implement RWLOCK annotations
llvm-svn: 162019
2012-08-16 13:29:41 +00:00
Dmitry Vyukov f77c6ea7ea tsan: fix COMPAT shadow mapping for new memory allocator
llvm-svn: 162018
2012-08-16 13:27:25 +00:00
Dmitry Vyukov 912f3bf279 tsan: refactor cur_thread() -> thr
llvm-svn: 162017
2012-08-16 13:26:54 +00:00
Dmitry Vyukov 1c0b3c6b84 tsan: store sync objects in memory block headers + delete them when the block is freed
llvm-svn: 161959
2012-08-15 17:27:20 +00:00
Dmitry Vyukov 9f1509fe44 tsan: provide function that imitates write to a region but does not detect races
llvm-svn: 161957
2012-08-15 16:52:19 +00:00
Alexander Potapenko cfb2a6b074 Remove the extra semicolon reported by the buildbot.
llvm-svn: 161954
2012-08-15 15:59:18 +00:00