Commit Graph

1441 Commits

Author SHA1 Message Date
Kostya Serebryany c14ae88b08 [asan/msan] add BulkAllocate to the 32-bit allocator (and a test)
llvm-svn: 169506
2012-12-06 14:27:32 +00:00
Kostya Serebryany 0f67d01031 [asan/msan] refactor allocator's BulkAllocate (move to AllocatorFreeList)
llvm-svn: 169503
2012-12-06 13:34:11 +00:00
Dmitry Vyukov 6ee2cde066 tsan: add new file to cmake
llvm-svn: 169502
2012-12-06 13:32:49 +00:00
Dmitry Vyukov 72064188bc tsan: add some more functions for java filtering
llvm-svn: 169501
2012-12-06 13:20:37 +00:00
Kostya Serebryany 9f84eecc9e [asan/msan] add GetBlockBegin to the 32-bit allocator (+test)
llvm-svn: 169499
2012-12-06 13:13:58 +00:00
Kostya Serebryany 2731cb23b1 [asan/msan] one more test for 32-bit allocator
llvm-svn: 169497
2012-12-06 13:00:11 +00:00
Kostya Serebryany 2044135dca [asan/msan] new 32-bit allocator, basic functionality so far
llvm-svn: 169496
2012-12-06 12:49:28 +00:00
Dmitry Vyukov fd1ba2af7d tsan: add 'free' to java nonsense reports
llvm-svn: 169494
2012-12-06 12:42:53 +00:00
Dmitry Vyukov fd5ebcd1b0 tsan: add mutexsets to reports
With this change reports say what mutexes the threads hold around the racy memory accesses.

llvm-svn: 169493
2012-12-06 12:16:15 +00:00
Bill Wendling f9528843d2 Remove unused variable.
llvm-svn: 169485
2012-12-06 07:43:17 +00:00
Kostya Serebryany 1e3d387459 [tsan] add MmapAlignedOrDie
llvm-svn: 169474
2012-12-06 06:10:31 +00:00
Kostya Serebryany 86975ce3fb [asan] drop the extension from asan tests (as the extension may be different)
llvm-svn: 169392
2012-12-05 17:56:54 +00:00
Kostya Serebryany 1a6f4d4ba6 [asan] undo the debug printf
llvm-svn: 169381
2012-12-05 13:39:29 +00:00
Dmitry Vyukov d413d8cfa9 tsan: fix memory barriers in atomics
llvm-svn: 169379
2012-12-05 13:14:55 +00:00
Dmitry Vyukov c446aa039a tsan: provide own implementation of __cxa_guard_xxx functions
that way we allow static linking of libstdc++

llvm-svn: 169376
2012-12-05 12:10:22 +00:00
Dmitry Vyukov 6411bd9877 tsan: remove unnecesary include file
llvm-svn: 169370
2012-12-05 10:16:17 +00:00
Dmitry Vyukov dd95cd148b tsan: fix lint warnings
llvm-svn: 169369
2012-12-05 10:16:02 +00:00
Kostya Serebryany 571232b8cf [tsan] get rid of *allocator64* files, moving everything to *allocator* files. This will help with the 32-bit allocator implementation and testing
llvm-svn: 169368
2012-12-05 10:09:15 +00:00
Kostya Serebryany 0afbb325b6 [tsan] make the 64-bit allocator build (but not work) in 32-bit mode to simplify the code and test structure and allow further refactoring
llvm-svn: 169361
2012-12-05 07:11:47 +00:00
Alexander Potapenko 0a4e0f6d35 Fix a use-after-unmap bug in /proc/self/maps caching. The cached buffer was occasionally deleted in the MemoryMappingLayout destructor.
llvm-svn: 169335
2012-12-04 23:30:00 +00:00
Dmitry Vyukov 1b46993598 tsan: output thread names
llvm-svn: 169279
2012-12-04 15:46:05 +00:00
Kostya Serebryany 242b6305f0 [tsan] add a compile-time error for 64-bit-only support
llvm-svn: 169275
2012-12-04 15:13:30 +00:00
Dmitry Vyukov 4b82b2bb6e tsan: make atomic operations atomic again
llvm-svn: 169273
2012-12-04 14:50:10 +00:00
Kostya Serebryany 7436d95c9c [tsan] test the allocator with CompactSizeClassMap
llvm-svn: 169270
2012-12-04 14:39:51 +00:00
Kostya Serebryany f299288f55 [tsan] minor interface refactoring
llvm-svn: 169267
2012-12-04 14:15:17 +00:00
Dmitry Vyukov 4ef6b2bd03 tsan: fix nand operation
llvm-svn: 169266
2012-12-04 14:08:39 +00:00
Dmitry Vyukov 01ea653166 tsan: add __attribute__((visibility("default"))) to interface functions
llvm-svn: 169265
2012-12-04 14:01:21 +00:00
Kostya Serebryany 5e6f833bdd [tsan] refactor the allocator tests to allow testing other flavours of the allocator (add templates)
llvm-svn: 169264
2012-12-04 13:59:22 +00:00
Dmitry Vyukov 55b47cad33 tsan: fix trace handling when trace is reused between threads
llvm-svn: 169259
2012-12-04 12:19:53 +00:00
Kostya Serebryany 077f88045e [tsan] refactoring and comment changes in sanitizer_common/sanitizer_allocator{,64}.h. No functionality change
llvm-svn: 169234
2012-12-04 07:54:41 +00:00
Dmitry Vyukov 0d677279f6 tsan: better error message if we fail to intercept some function
currently the message is SIGSEGV

llvm-svn: 169231
2012-12-04 07:28:25 +00:00
Dmitry Vyukov d229abe49a tsan: check if PWD env var is absent
On some programs I see:
failed to open suppressions file '<null>/testing/tsan/v2/tsan.supp'

llvm-svn: 169230
2012-12-04 07:27:32 +00:00
Alexander Potapenko 0dcd6d9468 [ASan] Do not build the interceptors that use ObjC blocks if the compiler does not support blocks.
Need to define MISSING_BLOCKS_SUPPORT in this case at buildtime.

Patch by Jack Howarth <howarth@bromo.med.uc.edu>
 

llvm-svn: 169206
2012-12-04 02:41:47 +00:00
Alexey Samsonov 45b6edbd1d ASan: add new interface functions - __asan_(un)poison_stack_memory. Calls to these functions are inserted by the instrumentation pass in use-after-scope mode
llvm-svn: 169201
2012-12-04 01:38:15 +00:00
Alexander Potapenko e2b6d08459 Use a struct to hold the /proc/self/maps buffer on Linux.
llvm-svn: 169155
2012-12-03 21:21:22 +00:00
Kostya Serebryany 214b715061 [asan] two more bits for __sparc__
llvm-svn: 169141
2012-12-03 18:39:21 +00:00
Kostya Serebryany 485f7b4a70 [tsan] add CompactSizeClassMap as an alternative (more compact) size class map. Not used yet.
llvm-svn: 169128
2012-12-03 15:00:33 +00:00
Kostya Serebryany dab61684ef [tsan] remove unused InternalAllocBlock as part of larger refactoring
llvm-svn: 169123
2012-12-03 11:57:01 +00:00
Dmitry Vyukov e982a1d368 tsan: describe global vars (module+offset for now)
llvm-svn: 169122
2012-12-03 11:45:34 +00:00
Kostya Serebryany a960b2c6da [asan] EXPECT_EQ => ASSERT_EQ around pthread_create/pthread_join calls
llvm-svn: 169121
2012-12-03 11:37:03 +00:00
Kostya Serebryany d5aafcf618 [asan] in asan tests, check all return values of pthread_create/pthread_join. Also add the ASAN_AVOID_EXPENSIVE_TESTS macro to guard the test that creates too many threads
llvm-svn: 169118
2012-12-03 09:43:56 +00:00
Will Dietz 2c36c71f5b [ubsan] Refactor handlers to have separate entry points for aborting.
If user specifies aborting after a recoverable failed check is
appropriate, frontend should emit call to the _abort variant.

Test this behavior with newly added -fsanitize-recover flag.

llvm-svn: 169113
2012-12-02 19:47:29 +00:00
Will Dietz b28179be10 [ubsan] Replace "fatal error" with "runtime error".
llvm-svn: 169112
2012-12-02 18:43:33 +00:00
Alexander Potapenko 7811425843 Add caching to the MemoryMappingLayout class on Linux. This is necessary for the cases when a sandbox prevents ASan from reading the mappings
from /proc/self/maps.
The mappings are currently being cached on each access to /proc/self/maps. In the future we'll need to add an API that allows the client to notify ASan about the sandbox.

llvm-svn: 169076
2012-12-01 02:39:45 +00:00
Dmitry Vyukov e993dac233 tsan: fix int overflow and several instances where tid is used with ignore
llvm-svn: 169029
2012-11-30 20:02:11 +00:00
Dmitry Vyukov d05418eac6 tsan: suppress weird race reports when JVM is embed into the process
llvm-svn: 169019
2012-11-30 17:45:53 +00:00
Dmitry Vyukov 1450ac6406 tsan: add __libc_memalign interceptor (used by dynamic loader to allocate tls for dlopen'ed modules)
llvm-svn: 169017
2012-11-30 17:27:58 +00:00
Dmitry Vyukov ad9c530f7c tsan: add sanity checks into memory allocator
llvm-svn: 169015
2012-11-30 17:26:50 +00:00
Kostya Serebryany 436462046a [asan] make asan_test.cc more gcc-friendly
llvm-svn: 168992
2012-11-30 10:41:42 +00:00
Kostya Serebryany 6a786e66cf [asan] simplify break_optimization in tests (Jakub Jelinek)
llvm-svn: 168990
2012-11-30 09:52:44 +00:00
Dmitry Vyukov 71d759d392 tsan: intercept mlock() because of the kernel bug
llvm-svn: 168987
2012-11-30 06:50:15 +00:00
Dmitry Vyukov 0a4d875c48 tsan: fix bug that leads to spurious use-after-free reports
llvm-svn: 168985
2012-11-30 06:39:01 +00:00
Richard Smith 57000c38fc ubsan: Disable __int128 tests if the host Clang does not support it. These
tests will still fail if compiler-rt was built with a compiler without __int128
support, but the host compiler has __int128 support.

llvm-svn: 168955
2012-11-29 23:03:58 +00:00
Alexey Samsonov b90501d7da [ASan] use brand new -fsanitize= values for init-order/use-after-return ASan output tests
llvm-svn: 168951
2012-11-29 22:56:01 +00:00
Kostya Serebryany dde9dcc24b [asan] disable BuiltinLongJmpTest on Android
llvm-svn: 168872
2012-11-29 12:18:48 +00:00
Kostya Serebryany e73a480970 [asan] enable BuiltinLongJmpTest
llvm-svn: 168863
2012-11-29 09:02:14 +00:00
Richard Smith 99507e6c10 ubsan: Don't assume that Clang provides __int128 unless it advertises that it does.
llvm-svn: 168857
2012-11-29 05:59:30 +00:00
Kostya Serebryany df5f3028e2 [asan] add DISABLED_BuiltinLongJmpTest
llvm-svn: 168793
2012-11-28 15:01:23 +00:00
Dmitry Vyukov 4a48553869 tsan: explicitly say that failed to restore the stack
llvm-svn: 168790
2012-11-28 13:30:06 +00:00
Dmitry Vyukov eb3d36e649 tsan: address several review comments
llvm-svn: 168789
2012-11-28 13:01:32 +00:00
Dmitry Vyukov 3374e3f874 tsan: add log_path parameter (similar to asan)
remove old log_fileno

llvm-svn: 168788
2012-11-28 12:56:52 +00:00
Dmitry Vyukov e1a7f338a3 tsan: dynamic history size
introduces history_size parameter that can be used to control trace size at startup

llvm-svn: 168786
2012-11-28 12:19:50 +00:00
Dmitry Vyukov 00e4604d6b tsan: change fast state layout in preparation to dynamic traces
llvm-svn: 168784
2012-11-28 10:49:27 +00:00
Dmitry Vyukov 2429b02770 tsan: move traces from tls into dedicated storage at fixed address
helps to reduce tls size (it's weird to have multi-MB tls)
will help with dynamically adjustable trace size

llvm-svn: 168783
2012-11-28 10:35:31 +00:00
Dmitry Vyukov 05d7ade34d tsan: add description of memory layouts in different configs
llvm-svn: 168777
2012-11-28 07:44:26 +00:00
Will Dietz 2631aaf939 ubsan: Support unsigned overflows, and divide-by-zero int/float split.
llvm-svn: 168700
2012-11-27 15:01:43 +00:00
Dmitry Vyukov ec8da99846 tsan: fix macro mess
llvm-svn: 168697
2012-11-27 12:51:16 +00:00
Dmitry Vyukov 69a071d5a6 tsan: fix compilation for dead old compilers (why we are supporting them at all?..)
llvm-svn: 168693
2012-11-27 09:35:44 +00:00
Dmitry Vyukov 210c21129e tsan: add memory range access functions to public iface
llvm-svn: 168692
2012-11-27 08:41:39 +00:00
Dmitry Vyukov 59d58665ee tsan: add 128-bit atomic operations
llvm-svn: 168683
2012-11-27 07:41:27 +00:00
Dmitry Vyukov 10362c46f1 tsan: refactor atomic operations implementation
do the atomic operation under the sync object mutex
make acquire/release sync atomic with the operation itself
combine acquire and release into a single acq_rel operation

llvm-svn: 168682
2012-11-27 07:25:50 +00:00
Nick Kledzik 9fb21e57e5 Automatically create .dSYM for libcompiler_rt.dylib when using Apple's internal build system
llvm-svn: 168625
2012-11-26 22:48:51 +00:00
Dmitry Vyukov 20678e2b68 tsan: explicitly mark symbols referenced from assembly as hidden
this allows to build tsan runtime as dynamic library

llvm-svn: 168589
2012-11-26 14:20:26 +00:00
Kostya Serebryany 19e34c23c5 [asan] fix Android build by not calling GetPageSizeCached in a test (no need for the page size anyway)
llvm-svn: 168585
2012-11-26 11:23:30 +00:00
Dmitry Vyukov 3b4501254f tsan: add atomic nand operation
llvm-svn: 168584
2012-11-26 09:42:56 +00:00
Dmitry Vyukov ce7a1ba196 tsan: faster memory reset for Go
llvm-svn: 168567
2012-11-25 16:05:42 +00:00
Kostya Serebryany df198db1aa [asan/tsan] get rid of kPageSize completely in favor of GetPageSizeCached(). This makes the code friendly to more platforms
llvm-svn: 168537
2012-11-24 05:03:11 +00:00
Dmitry Vyukov 195eda9922 tsan: add failure memory order to atomic compare exchange functions
llvm-svn: 168518
2012-11-23 15:51:45 +00:00
Kostya Serebryany f22c697f58 [asan] get rid of some of the uses of kPageSize. The intent is to get rid of it completely to support platforms with multiple possible page sizes.
llvm-svn: 168517
2012-11-23 15:38:49 +00:00
Alexey Samsonov 1a05424ee0 [ASan] move swapcontext_test to Linux-specific tests
llvm-svn: 168513
2012-11-23 11:20:54 +00:00
Alexey Samsonov aac36b345a [ASan] intercept swapcontext on Linux only
llvm-svn: 168509
2012-11-23 10:14:44 +00:00
Alexey Samsonov 0d7755ccb5 [ASan] Add interceptor for swapcontext to fight with false positives in some of its use cases.
llvm-svn: 168508
2012-11-23 09:46:34 +00:00
Dmitry Vyukov db584aded7 tsan: ensure than func entry/exit are inlined
llvm-svn: 168506
2012-11-23 07:14:11 +00:00
Dmitry Vyukov 6971414f3e tsan: fix more bugs in signal handling
llvm-svn: 168497
2012-11-22 13:53:54 +00:00
Dmitry Vyukov 3048e1a399 tsan: add missing \n in report
llvm-svn: 168496
2012-11-22 13:38:28 +00:00
Dmitry Vyukov 35437032be tsan: better error message for OOM
llvm-svn: 168491
2012-11-22 08:42:01 +00:00
Kostya Serebryany 8bc5421ba0 [asan] get rid of kPageSizeBits
llvm-svn: 168426
2012-11-21 13:31:07 +00:00
Evgeniy Stepanov 979a1e7352 Allow PopStackFrames leave the stack empty.
llvm-svn: 168425
2012-11-21 13:00:04 +00:00
Kostya Serebryany 734f1eb5f4 [asan/tsan] do not use __WORDSIZE macro, as it is glibc-private thing. Instead, define our own SANITIZER_WORDSIZE
llvm-svn: 168424
2012-11-21 12:38:58 +00:00
Dmitry Vyukov aeed45cde0 tsan: explictly say when we fail to restore a stack trace
llvm-svn: 168423
2012-11-21 11:44:20 +00:00
Alexey Samsonov 3a3488e4e1 [Sanitizer] replace while with internal_memset to make sure compiler won't replace it with library memset
llvm-svn: 168422
2012-11-21 11:12:57 +00:00
Dmitry Vyukov 9ca2afd3a1 tsan: fix handling of signals
(do not execute synchronous signals in recursive interceptors)

llvm-svn: 168421
2012-11-21 11:12:33 +00:00
Kostya Serebryany 6db8ad43df [asan] pop the two internal functions from the stack trace produced by _Unwind_Backtrace (Peter Bergner)
llvm-svn: 168369
2012-11-20 15:15:44 +00:00
Kostya Serebryany 87e0464bfb [asan] better support for powerpc and sparc targets (thanks to H.J. Liu and David Miller)
llvm-svn: 168358
2012-11-20 08:57:26 +00:00
Kostya Serebryany 46de580003 [asan] more support for powerpc, patch by Peter Bergner
llvm-svn: 168356
2012-11-20 07:00:42 +00:00
Alexey Samsonov 27a22688b9 [ASan] use raw Exit() to kill the program in case ASan finds an error while reporting the error in the same thread
llvm-svn: 168308
2012-11-19 11:22:22 +00:00
Kostya Serebryany 386e2d853b [asan] support x32 mode in the fast stack unwinder. Patch by H.J. Lu
llvm-svn: 168306
2012-11-19 10:31:00 +00:00
Alexey Samsonov 06b22c1513 [ASan] change interface of GetAccumulatedStats() function to prevent Clang from inserting memcpy() call into runtime.
llvm-svn: 168305
2012-11-19 10:25:17 +00:00
Kostya Serebryany cb9f62189b [asan] support PowerPC and SPARC in sanitizer_linux.cc
llvm-svn: 168301
2012-11-19 07:53:36 +00:00
Alexey Samsonov 56f1ef7d3b ubsan: fix broken test case by using brand new [[@LINE]] FileCheck feature
llvm-svn: 168170
2012-11-16 13:38:03 +00:00