Commit Graph

988 Commits

Author SHA1 Message Date
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
Dmitry Vyukov 954fc8c3e4 tsan: switch to new allocator
llvm-svn: 161953
2012-08-15 15:35:15 +00:00
Alexander Potapenko f6344ffe39 Introduce asan_intercepted_functions.h which contains the declarations wrapped functions and their wrappers.
Those declarations are going to be shared between asan_interceptors.cc and the dynamic runtime library on Mac OS.

llvm-svn: 161952
2012-08-15 15:24:48 +00:00
Alexey Samsonov 5b2c6ea38f [ASan] lit tests: use nm instead of llvm-nm, until llvm-nm becomes usable on Mac. Port output test change in r161948 to lit
llvm-svn: 161951
2012-08-15 14:33:30 +00:00
Dmitry Vyukov 4b5ec3145a tsan: add some more tests for memory allocator
llvm-svn: 161950
2012-08-15 14:25:33 +00:00
Dmitry Vyukov c693689bb1 tsan: fix several integer overflows
llvm-svn: 161949
2012-08-15 14:25:08 +00:00
Alexander Potapenko 6c1de8faa7 Check for filenames and numbers to detect possible problems with asan_symbolize.py on -fPIE binaries.
llvm-svn: 161948
2012-08-15 14:00:09 +00:00
Alexander Potapenko 1800362758 Pass offset of the frame address within the binary to addr2line instead of the absolute address.
Fixes the problem with -PIE binaries.

llvm-svn: 161947
2012-08-15 13:58:24 +00:00
Alexander Potapenko 07ea07c3ca Patch the frame address regardless of the frame number.
llvm-svn: 161946
2012-08-15 13:23:03 +00:00
Alexander Potapenko 20f9fcc285 Move the prototype of __CFInitialize to asan_mac.h so that asan_malloc_mac.cc may use it in the dynamic library mode.
llvm-svn: 161945
2012-08-15 12:23:36 +00:00
Alexander Potapenko 9a168a7405 Use SANITIZER_INTERFACE_ATTRIBUTE instead of __attribute__((visibility("default")))
Export CheckFailed, asan_malloc, asan_free, asan_memalign, AsanStackTrace::CompressStack, AsanStackTrace::UncompressStack from the dynamic runtime library.

llvm-svn: 161943
2012-08-15 11:57:52 +00:00
Alexander Potapenko 55df945db2 Make __asan::asan_{malloc,free,memalign} globally visible, so that the dynamic version of the runtime will export them.
llvm-svn: 161942
2012-08-15 11:32:15 +00:00