Richard Smith
64e25ce53d
Move C++ name demangling support from ubsan into sanitizer_common.
...
llvm-svn: 170666
2012-12-20 05:00:13 +00:00
Alexey Samsonov
826b324cb0
[ASan] explicitly link with dynamic ASan runtime when building unittests on Android
...
llvm-svn: 170552
2012-12-19 15:52:30 +00:00
Alexey Samsonov
85bd73d259
[ASan] Support building both 32- and 64-bit unit tests if we can target both architectures
...
llvm-svn: 170549
2012-12-19 15:17:23 +00:00
Kostya Serebryany
dcdeecb257
[asan] asan_allocator2: add mmap/munmap stats
...
llvm-svn: 170548
2012-12-19 14:56:38 +00:00
Alexey Samsonov
b29d37bea5
[ASan] make sure Android unittests depend on ASan runtime
...
llvm-svn: 170543
2012-12-19 13:46:58 +00:00
Alexey Samsonov
ca7fcf2354
Significantly change the way we build ASan unittests in CMake
...
build tree. Now just-built Clang is used to:
1) compile instrumented sources (as before);
2) compile non-instrumented sources;
3) compile our own instrumented version of googletest;
4) link it all together using -fsanitize=address flag
(instead of trying to copy linker behavior in
CMake build rules).
This makes ASan unittests pretty much self-consistent
and independent of other LLVM libraries.
llvm-svn: 170541
2012-12-19 12:33:39 +00:00
Alexander Potapenko
7e1fcb8136
[ASan] Change the boilerplate check in the libdispatch tests to fix them.
...
llvm-svn: 170531
2012-12-19 11:26:41 +00:00
Kostya Serebryany
d5c46cb2f7
[asan] print the shadow bytes in different colors and also output the shadow byte legend
...
llvm-svn: 170520
2012-12-19 09:53:32 +00:00
Alexey Samsonov
d12943e028
[TSan] build only gtest-all.o when building TSan unit tests
...
llvm-svn: 170519
2012-12-19 09:19:57 +00:00
Dmitry Vyukov
1ed72076b4
tsan: add lint check back into presubmit script
...
llvm-svn: 170515
2012-12-19 08:53:31 +00:00
Alexey Samsonov
35ed02ebf1
[Sanitizer] add missing header on Windows
...
llvm-svn: 170514
2012-12-19 08:51:39 +00:00
Kostya Serebryany
479f05b276
[asan] asan_allocator2: improve FindHeapChunkByAddress to find memory chunks to the left of a given address. Almost all tests pass with the new allocator now, only 6 are left to fix.
...
llvm-svn: 170511
2012-12-19 08:32:50 +00:00
Alexey Samsonov
b6219c060b
[Sanitizer] implement internal_isatty on Windows
...
llvm-svn: 170507
2012-12-19 07:57:42 +00:00
Dmitry Vyukov
c467933dc7
tsan: fix -Wgnu warnings
...
llvm-svn: 170499
2012-12-19 06:59:45 +00:00
Kostya Serebryany
2abbce6701
[sanitizer] one more stability fix in 64-bit allocator
...
llvm-svn: 170498
2012-12-19 06:51:45 +00:00
Kostya Serebryany
12676268fa
[sanitizer] fix LargeMmapAllocator::GetBlockBegin
...
llvm-svn: 170434
2012-12-18 14:56:38 +00:00
Dmitry Vyukov
44e1beaee6
tsan: intercept fork() to prevent false race reports on fd's
...
llvm-svn: 170433
2012-12-18 14:44:44 +00:00
Dmitry Vyukov
a2ce1e0055
tsan: warn about reports from signal handlers
...
llvm-svn: 170430
2012-12-18 14:19:24 +00:00
Dmitry Vyukov
d509179a0b
tsan: add signalfd() and inotify_init() interceptors
...
llvm-svn: 170429
2012-12-18 12:35:31 +00:00
Dmitry Vyukov
42230ae216
tsan: add io_sync flag that controls amount of IO synchronization
...
llvm-svn: 170427
2012-12-18 12:20:55 +00:00
Dmitry Vyukov
9c7bcfea6f
tsan: remove TSAN_OPTIONS from the script
...
The runtime skips atexit sleep if there are no threads now,
so it must be fast w/o it.
Allows to specify own TSAN_OPTIONS for the tests.
llvm-svn: 170426
2012-12-18 12:19:50 +00:00
Alexey Samsonov
f37c45c20d
[Sanitizer] Expose StackTrace::GetPreviousInstructionPc() to get PC of call instruction from return address
...
llvm-svn: 170424
2012-12-18 09:57:34 +00:00
Richard Smith
7e45562ad0
ubsan: Demangle class names, and be more informative when a reinterpret_cast
...
has got us to the wrong offset within an object.
llvm-svn: 170423
2012-12-18 09:30:21 +00:00
Kostya Serebryany
bad01549b6
[asan] add some colors to asan output if printing to tty (following ubsan)
...
llvm-svn: 170418
2012-12-18 07:32:16 +00:00
Dmitry Vyukov
6d315cbcc3
tsan: describe "file descriptor" location
...
llvm-svn: 170417
2012-12-18 06:57:34 +00:00
Richard Smith
cf56ebd52a
ubsan: When diagnosing something wrong somewhere in memory, emit a note
...
pointing at the bad location and a snippet of nearby memory values. This is
strictly best-effort; reading these bytes to display the note could lead to a
seg fault, and that's explicitly OK.
llvm-svn: 170415
2012-12-18 06:30:32 +00:00
Richard Smith
54fc2370f9
Don't escape %s in printf usage message; it's not written by printf.
...
llvm-svn: 170413
2012-12-18 05:49:49 +00:00
Richard Smith
52987120f9
ubsan: if the frontend didn't provide us with a source location, try to work
...
one out from the return address. Currently, we can only resolve this address to
a file and line number if we have an external symbolizer.
llvm-svn: 170407
2012-12-18 04:23:18 +00:00
Richard Smith
37a913ae8f
Rein ubsan's vptr sanitizer back a bit. Per core issue 453, binding a reference
...
to an object outside its lifetime does not have undefined behavior.
llvm-svn: 170388
2012-12-18 00:23:12 +00:00
Dmitry Vyukov
09b0dbfaf9
tsan: say what thread had created a thread in reports
...
llvm-svn: 170346
2012-12-17 16:28:15 +00:00
Kostya Serebryany
d6aec5a8e0
[asan] asan_allocator2: implement malloc_usable_size and fix 32-bit
...
llvm-svn: 170339
2012-12-17 14:57:25 +00:00
Kostya Serebryany
ec339f70d6
[asan] asan_allocator2: don't use TLS and fix calloc
...
llvm-svn: 170329
2012-12-17 13:43:47 +00:00
Kostya Serebryany
1aae0e67fa
[asan] asan_alocator2: implement quarantine and Reallocate
...
llvm-svn: 170315
2012-12-17 09:06:25 +00:00
Kostya Serebryany
41ffe3db59
[asan] implement AsanChunkFifoList via IntrusiveList<AsanChunk>
...
llvm-svn: 170313
2012-12-17 07:54:29 +00:00
Kostya Serebryany
c510015419
[asan] asan_alocator2: implement free() stacks and actually make malloc/free stacks work
...
llvm-svn: 170310
2012-12-17 06:31:53 +00:00
Kostya Serebryany
c8208c5258
[sanitizer] fix a bug that has crept into the sanitizer allocator and caused SEGV on allocations between 1Mb and 2Mb, improve the test
...
llvm-svn: 170274
2012-12-15 18:36:23 +00:00
Dmitry Vyukov
38d0b60fb9
tsan: synchronize connect->accept calls
...
llvm-svn: 170235
2012-12-14 20:01:58 +00:00
Alexey Samsonov
6a68a9117b
[Sanitizer] remove extra typename
...
llvm-svn: 170208
2012-12-14 15:37:35 +00:00
Dmitry Vyukov
5a3d15c126
tsan: add test for errno spoiling in signal handler
...
llvm-svn: 170207
2012-12-14 14:42:40 +00:00
Kostya Serebryany
673c052631
[sanitizer] add AllocatorLeakTest
...
llvm-svn: 170206
2012-12-14 14:20:29 +00:00
Dmitry Vyukov
be6005a0d5
tsan: add test for malloc/free in signal handler
...
llvm-svn: 170205
2012-12-14 13:56:27 +00:00
Evgeniy Stepanov
fb37510e96
Add MemorySanitizer.cpp to the lint script.
...
llvm-svn: 170204
2012-12-14 13:48:55 +00:00
Dmitry Vyukov
51b6e07deb
tsan: fix lint warning
...
llvm-svn: 170202
2012-12-14 13:46:03 +00:00
Kostya Serebryany
025d64a1b9
[asan] more asan_allocator2 code: record the allocation stack trace, implement calloc/etc
...
llvm-svn: 170193
2012-12-14 13:16:19 +00:00
Dmitry Vyukov
5b375d84c0
tsan: fix build
...
llvm-svn: 170191
2012-12-14 12:24:11 +00:00
Kostya Serebryany
7dfb168eb8
[asan] more asan_allocator2 code: actually un/poison shadow on malloc/free
...
llvm-svn: 170190
2012-12-14 12:15:09 +00:00
Alexey Samsonov
cd1e68ebb1
[Sanitizer] use INTERCEPT_FUNCTION(foo) instead of CHECK(INTERCEPT_FUNCTION(foo)) - this check may fail on Linux if user program defines its own version of library function foo
...
llvm-svn: 170189
2012-12-14 11:52:02 +00:00
Dmitry Vyukov
34aef74a4d
tsan: disable allocator tests in debug build
...
llvm-svn: 170187
2012-12-14 10:17:22 +00:00
Dmitry Vyukov
ed6d54368c
tsan: comment out debug output in test
...
llvm-svn: 170186
2012-12-14 10:12:14 +00:00
Dmitry Vyukov
714accd917
tsan: add sanity test for Go runtime into presubmit test
...
llvm-svn: 170185
2012-12-14 10:10:57 +00:00
Dmitry Vyukov
e0c37640f7
tsan: add socketpair() interceptor and test
...
llvm-svn: 170184
2012-12-14 09:57:42 +00:00
Dmitry Vyukov
12ae8897e6
tsan: fix compilation with -pedantic
...
llvm-svn: 170131
2012-12-13 15:26:04 +00:00
Kostya Serebryany
bb69879d09
[asan] pop the internal stack frames in SlowUnwindStack, extend the test to check this
...
llvm-svn: 170124
2012-12-13 12:31:55 +00:00
Alexey Samsonov
506b97d61e
[Sanitizer] disable lint check for line length in ASan output tests
...
llvm-svn: 170123
2012-12-13 12:09:47 +00:00
Kostya Serebryany
704c1cb23a
[asan] extend overflow-in-qsort.cc to check both unwind kinds. One more test for SlowUnwind. Move both to Linux dir (no slow unwind on Mac)
...
llvm-svn: 170122
2012-12-13 11:47:49 +00:00
Alexey Samsonov
78ba6c1b37
[ASan] Allow leading underscore in function name to please output tests on Mac
...
llvm-svn: 170121
2012-12-13 11:11:28 +00:00
Alexey Samsonov
340de607a3
[ASan] don't print memory stats on CheckFailed
...
llvm-svn: 170120
2012-12-13 11:09:26 +00:00
Kostya Serebryany
060bfab568
[asan] fix win build
...
llvm-svn: 170119
2012-12-13 10:03:50 +00:00
Kostya Serebryany
6852bce2f2
[asan] fix mac build
...
llvm-svn: 170118
2012-12-13 10:01:20 +00:00
Kostya Serebryany
baf583c443
[asan] add two asan flags: fast_unwind_on_fatal and fast_unwind_on_malloc to allow using the slow CFI-based unwinder
...
llvm-svn: 170117
2012-12-13 09:34:23 +00:00
Dmitry Vyukov
3533f76996
tsan: completely disable deadlock detector for Go
...
seems to cause some weird stack overflow
llvm-svn: 170116
2012-12-13 09:22:11 +00:00
Alexey Samsonov
5a26e1fbf2
[Sanitizer] Add new header - sanitizer_platform_interceptors.h, which should define whether or not given function should be intercepted on a given platform.
...
llvm-svn: 170115
2012-12-13 08:50:16 +00:00
Alexey Samsonov
447e2f2f19
[ASan] one more macro for 'read' interception
...
llvm-svn: 170114
2012-12-13 08:36:13 +00:00
Dmitry Vyukov
3e7ede230f
tsan: support MapThreadTrace() on all platforms
...
llvm-svn: 170113
2012-12-13 08:14:02 +00:00
Alexey Samsonov
65c14f5314
[ASan] more macro for conditional interception of pread functions
...
llvm-svn: 170112
2012-12-13 08:10:23 +00:00
Kostya Serebryany
ad81738822
[asan] add asan/lit_tests/overflow-in-qsort.cc (not fully working yet)
...
llvm-svn: 170111
2012-12-13 08:05:03 +00:00
Richard Smith
177f80376d
ubsan unit tests for -fsanitize=bool and -fsanitize=enum.
...
llvm-svn: 170109
2012-12-13 07:12:20 +00:00
Richard Smith
32952215b6
ubsan: Add -fsanitize=bool and -fsanitize=enum, which check for loads of
...
bit-patterns which are not valid values for enumerated or boolean types.
These checks are the ubsan analogue of !range metadata.
llvm-svn: 170107
2012-12-13 07:00:14 +00:00
Kostya Serebryany
07bb3925b0
[sanitizer] replace size_t with SIZE_T in interceptors (same for ssize_t, off_t and off64_t). This is done to avoid confusion and to make the code work with compilers that define size_t w/o any includes (MSVC)
...
llvm-svn: 170103
2012-12-13 06:31:40 +00:00
Kostya Serebryany
a167087571
[asan] fix windows build
...
llvm-svn: 170101
2012-12-13 05:51:02 +00:00
Kostya Serebryany
9806628792
[sanitizer] introduce MmapFixedOrDie and use it in SizeClassAllocator64
...
llvm-svn: 170099
2012-12-13 05:36:00 +00:00
Kostya Serebryany
eec22a628b
[asan] fix the Android build (pread64 interceptor again)
...
llvm-svn: 170098
2012-12-13 05:27:08 +00:00
Kostya Serebryany
2ce42e0aef
[sanitizer] change the way SizeClassAllocator64 allocated memory from the system: instead of one huge mmap(NORESERVE) it does one huge mprotect and then does small on-demand mmaps. This allows us to call OnMap callbacks which are required to poison newly allocated memory in asan
...
llvm-svn: 170097
2012-12-13 05:05:11 +00:00
Alexander Potapenko
d27e4861bf
[ASan] Fix test expectations for strcat/strncat.
...
llvm-svn: 169987
2012-12-12 16:10:46 +00:00
Kostya Serebryany
e29883c10a
[sanitizer] add OnMap/OnUmap callbacks to the allocator interface
...
llvm-svn: 169985
2012-12-12 14:32:18 +00:00
Kostya Serebryany
c219f6c777
[tsan] fix cmake build
...
llvm-svn: 169982
2012-12-12 14:26:06 +00:00
Dmitry Vyukov
7d95323047
tsan: explain why pthread_cond_init() interceptor is commented out
...
llvm-svn: 169975
2012-12-12 13:11:44 +00:00
Alexander Potapenko
dab1a61011
[ASan] Enhance OOB tests to check for access type (read or write).
...
llvm-svn: 169974
2012-12-12 12:59:47 +00:00
Dmitry Vyukov
9ba0f3d51c
tsan: add comment to tsan_fd.h file
...
llvm-svn: 169973
2012-12-12 12:45:07 +00:00
Alexander Potapenko
602a09fa52
[ASan] Fixed a compiler warning.
...
llvm-svn: 169972
2012-12-12 12:32:57 +00:00
Dmitry Vyukov
9190a036d7
tsan: add missing files
...
llvm-svn: 169971
2012-12-12 12:27:00 +00:00
Dmitry Vyukov
60c14ce625
tsan: more precise handling of IO synchronization
...
llvm-svn: 169970
2012-12-12 11:59:30 +00:00
Alexander Potapenko
ada2fbd2d4
[ASan] fix compilation on Mac.
...
llvm-svn: 169969
2012-12-12 11:52:26 +00:00
Kostya Serebryany
28a32c89e9
[asan] fix android build and lint
...
llvm-svn: 169968
2012-12-12 11:37:23 +00:00
Evgeniy Stepanov
4e772db66a
[msan] Remove an extra semicolon.
...
llvm-svn: 169967
2012-12-12 10:50:48 +00:00
Kostya Serebryany
9a58d399c7
[asan] add sanitizer_common/sanitizer_common_interceptors.h with pread/pread64/read interceptors. Use it in asan. Add asan tests for pread/etc. Add FIXME to tsan/msan interceptors
...
llvm-svn: 169966
2012-12-12 09:54:35 +00:00
Kostya Serebryany
90a59fafc0
[asan] more code for asan_allocator2: basic Allocate/Deallocate code
...
llvm-svn: 169864
2012-12-11 14:41:31 +00:00
Evgeniy Stepanov
83f05bf960
Add MemorySanitizer runtime to check_lint.sh.
...
llvm-svn: 169861
2012-12-11 12:52:38 +00:00
Evgeniy Stepanov
375aec7476
[msan] Add a missing file from r169858.
...
llvm-svn: 169860
2012-12-11 12:44:43 +00:00
Evgeniy Stepanov
c5033786ba
[msan] MemorySanitizer runtime.
...
Initial commit of the MemorySanitizer runtime library.
llvm-svn: 169858
2012-12-11 12:27:27 +00:00
Timur Iskhodzhanov
4c97604415
ASan: fix lint problems introduced
...
llvm-svn: 169857
2012-12-11 12:24:41 +00:00
Timur Iskhodzhanov
9b1d42a2a9
Hopefully fix the Windows build (2)
...
llvm-svn: 169856
2012-12-11 12:23:00 +00:00
Timur Iskhodzhanov
aacd3d79b1
Hopefully fix the Windows build by not including intrin.h
...
llvm-svn: 169855
2012-12-11 12:03:06 +00:00
Kostya Serebryany
5e2a7acdbe
[asan] more sceleton code for asan_allocator2
...
llvm-svn: 169836
2012-12-11 09:02:36 +00:00
Kostya Serebryany
54af660d2c
[asan] fix the Windows build
...
llvm-svn: 169828
2012-12-11 07:27:59 +00:00
Kostya Serebryany
3ba26fe553
[asan] make ThreadNamesTest more flexible
...
llvm-svn: 169822
2012-12-11 06:23:10 +00:00
Alexander Potapenko
af5a108ea8
[ASan] Typo fix in memcpy() and memmove() interceptors: ASAN_WRITE_RANGE and ASAN_READ_RANGE were swapped.
...
This has been spotted by Anna Zaks (ganna@apple.com )
llvm-svn: 169736
2012-12-10 16:02:13 +00:00
Kostya Serebryany
13bdbe698e
[asan] move FakeStack into a separate file
...
llvm-svn: 169734
2012-12-10 14:19:15 +00:00
Kostya Serebryany
14282a91d5
[asan] introduce asan_allocator2.cc, which will have the replacement for asan allocator (now, just a bit of boilerplate)
...
llvm-svn: 169733
2012-12-10 13:52:55 +00:00
Alexander Potapenko
1746f555ee
Add a libsanitizer API __sanitizer_sandbox_on_notify(void* reserved), which should be used by
...
the client programs to notify the tools that sandboxing is about to be turned on.
llvm-svn: 169732
2012-12-10 13:10:40 +00:00
Dmitry Vyukov
1046031e1a
tsan: exclude flaky test
...
llvm-svn: 169729
2012-12-10 09:16:17 +00:00
Alexey Samsonov
f0e638c6df
ASan: fix interface-symbols test on Mac by explicitly listing all weak functions
...
llvm-svn: 169660
2012-12-08 01:12:12 +00:00
Alexey Samsonov
5aa36def74
ASan: use new option -fsanitize-blacklist in output tests
...
llvm-svn: 169646
2012-12-07 22:21:21 +00:00
Alexey Samsonov
a0e4706fe6
ASan: change the strategy we use for installing malloc/free/symbolization hooks on Linux: don't provide a default no-op implementations for hooks in runtime, and optionally call hooks if they are provided by the user. Don't force weak interface functions into runtime.
...
llvm-svn: 169641
2012-12-07 22:01:28 +00:00
David Blaikie
a00d9caa8f
Unbreak the C++98 build.
...
llvm-svn: 169636
2012-12-07 21:39:54 +00:00
Dmitry Vyukov
54b87409b4
tsan: even more fd interceptors + fixes
...
llvm-svn: 169628
2012-12-07 19:23:59 +00:00
Dmitry Vyukov
04580518ce
tsan: more fd interceptors + bug fixes + tests
...
llvm-svn: 169621
2012-12-07 18:30:40 +00:00
Kostya Serebryany
40bac5b01f
[asan] fix lint, remove debug prints
...
llvm-svn: 169620
2012-12-07 18:07:52 +00:00
Alexey Samsonov
fa94fa52ad
ASan: intercept prctl on Linux only
...
llvm-svn: 169616
2012-12-07 17:54:38 +00:00
Dmitry Vyukov
0ef99e2a48
tsan: fix pipe interceptors and add 2 tests
...
llvm-svn: 169607
2012-12-07 16:22:54 +00:00
Dmitry Vyukov
3a2046b3a6
tsan: fix lint warnings
...
llvm-svn: 169606
2012-12-07 16:20:06 +00:00
Dmitry Vyukov
4e7c0f95fb
tsan: add pipe interceptors
...
llvm-svn: 169602
2012-12-07 15:32:56 +00:00
Kostya Serebryany
e7108227ca
[asan] intercept prctl(PR_SET_NAME) and set the thread name. Output the thread names (if non-empty) in asan reports
...
llvm-svn: 169601
2012-12-07 15:15:01 +00:00
Dmitry Vyukov
5f4ab30be0
tsan: refactoring is preparation to more precise fd synchronization handling
...
llvm-svn: 169600
2012-12-07 14:40:10 +00:00
Kostya Serebryany
35f9e5e87b
[sanitizer] implement SanitizerSetThreadName/SanitizerGetThreadName. Just for linux so far (using prctl(PR_GET_NAME))
...
llvm-svn: 169598
2012-12-07 11:27:24 +00:00
Evgeniy Stepanov
5d2d761ad6
Switch to r83 of cpplint.
...
Ubuntu Precise compatibility.
llvm-svn: 169597
2012-12-07 11:00:14 +00:00
Kostya Serebryany
52a3b92abd
[sanitizer] try not to use libc mem* functions in sanitizer_common tests (conflicts with our own interceptors)
...
llvm-svn: 169595
2012-12-07 10:13:10 +00:00
Kostya Serebryany
378f93e804
[sanitizer] fix the build on ancient gcc which has stricter rules about what can be put on TLS. Long term, we absolutely must build the run-times with the fresh target clang
...
llvm-svn: 169593
2012-12-07 09:40:17 +00:00
Dmitry Vyukov
5e700abc1c
tsan: deflake output tests (by increasing sleeps)
...
llvm-svn: 169592
2012-12-07 09:24:57 +00:00
Alexey Samsonov
a152d1b20d
arcconfig for compiler-rt
...
llvm-svn: 169575
2012-12-07 02:11:47 +00:00
Kostya Serebryany
6986550c7d
[sanitizer] POD-ify the allocator cache
...
llvm-svn: 169514
2012-12-06 16:22:04 +00:00
Dmitry Vyukov
e3e0557f19
tsan: fix lint warning and make output tests more robust
...
llvm-svn: 169511
2012-12-06 15:42:54 +00:00
Kostya Serebryany
6d2d30f61d
[asan/msan] one more test for 32-bit allocator + minor code simplification
...
llvm-svn: 169507
2012-12-06 14:39:41 +00:00
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
Alexey Samsonov
be9a293dda
UBSan: enable CMake build on Darwin. Fix two failing tests and disable the test which produces linker errors on Darwin.
...
llvm-svn: 168169
2012-11-16 12:57:07 +00:00
Alexey Samsonov
77d35747be
UBSan: fix support on Darwin in 'make' build system. Patch by Jean-Daniel Dupas.
...
llvm-svn: 168167
2012-11-16 12:51:23 +00:00
Dmitry Vyukov
4ee90c231a
asan: sync with gcc r193553
...
llvm-svn: 168151
2012-11-16 11:26:05 +00:00
Alexey Samsonov
4ac66c49da
[TSan] use explicit ctor for BlockingCall
...
llvm-svn: 168150
2012-11-16 11:21:07 +00:00
Alexey Samsonov
038e3489d9
[TSan] use llvm-symbolizer to run tsan tests
...
llvm-svn: 168146
2012-11-16 10:16:14 +00:00
Dmitry Vyukov
933c9889aa
tsan: remove unused parameter
...
llvm-svn: 168060
2012-11-15 18:49:08 +00:00
Dmitry Vyukov
f34db58c20
tsan: switch to 4 shadow cells by default (since that's what we use everywhere now)
...
llvm-svn: 168059
2012-11-15 18:44:22 +00:00
Dmitry Vyukov
262465c126
tsan: eevn better handling of signals
...
add interceptor for poll()
in addition process signals in every atomic op
in addition process signals in blocking libc functions
llvm-svn: 168050
2012-11-15 17:40:49 +00:00
Alexander Potapenko
bcc00a4174
[ASan] Revert r168040 and r168043 and take a cleaner solution suggested by Kostya: return the known frame name for fake stack instead of looking it up.
...
llvm-svn: 168046
2012-11-15 15:24:42 +00:00
Alexander Potapenko
93dcc8d2bd
[ASan] Minor fix: return to the last byte of the fake stack if we've raced by.
...
llvm-svn: 168043
2012-11-15 14:59:19 +00:00
Alexander Potapenko
b34db9e883
[ASan] Poison the leftmost shadow byte with a special value so that we can find
...
the beginning of the fake frame when reporting an use-after-return error.
Fixes http://code.google.com/p/address-sanitizer/issues/detail?id=126
llvm-svn: 168040
2012-11-15 13:40:44 +00:00
Alexey Samsonov
11aec95f4a
[UBSan] Add support for building ubsan runtime library on Linux with 'make'. Compiler-rt part.
...
llvm-svn: 168038
2012-11-15 12:37:55 +00:00
Alexander Potapenko
4d533d243d
[ASan] Add the "lea $imm(%rip),%rax" instruction to mach_override.c
...
The need for this has been reported by Jack Howarth (howarth@bromo.med.uc.edu ) who's porting ASan-Darwin to GCC
llvm-svn: 168032
2012-11-15 08:32:16 +00:00
Richard Smith
2674c6e39b
Fix typo from code review (thanks to Alexey Samsonov). This is also caught by the existing tests when building for i386.
...
llvm-svn: 167890
2012-11-13 23:58:20 +00:00
Richard Smith
6122d0692b
Support for building the ubsan runtime when using the autoconf build system on
...
Darwin. Patch by Jean-Daniel Dupas, tweaked by Jonathan Sauer, simplified
somewhat by me.
llvm-svn: 167889
2012-11-13 23:55:06 +00:00
Richard Smith
05dce7e644
-fsanitize=undefined: Switch to using sanitizer_common for output. This gets us much closer to not depending on any system headers.
...
llvm-svn: 167888
2012-11-13 23:42:05 +00:00
Kostya Serebryany
1f8922cf71
[asan] use #if defined __x86_64__ instead of #if __WORDSIZE == 64 in sanitizer_linux.cc
...
llvm-svn: 167883
2012-11-13 23:13:17 +00:00
Dmitry Vyukov
6d67d3b0ee
tsan: remove unused const
...
llvm-svn: 167835
2012-11-13 14:13:21 +00:00
Dmitry Vyukov
041eaf976c
tsan: better function names
...
llvm-svn: 167834
2012-11-13 14:05:58 +00:00
Alexey Samsonov
b8a5f99bee
[TSan] Add output test for write under reader lock
...
llvm-svn: 167833
2012-11-13 14:05:02 +00:00
Dmitry Vyukov
dcba4d1288
tsan: fix stats collection
...
llvm-svn: 167832
2012-11-13 13:53:43 +00:00
Alexey Samsonov
2906117857
[ASan] now we don't need llvm_obj_root to access llvm-symbolizer tool
...
llvm-svn: 167823
2012-11-13 07:55:16 +00:00
Alexey Samsonov
c835b9e4a3
[ASan] test blacklist functionality for global-init-order checker (r167725)
...
llvm-svn: 167727
2012-11-12 14:03:00 +00:00
Alexander Potapenko
9448581d9e
[ASan] Remove llvm-symbolizer from compiler-rt/utils/
...
This is the first (1/2) part of a change that moves llvm-symbolizer to llvm/tools/, which will allow to build it
with both cmake and configure+make.
llvm-svn: 167722
2012-11-12 11:32:42 +00:00
Alexander Potapenko
5066c5d9b7
[ASan] Fix the golden stack for use-after-free.cc.
...
The change has been caused by the switch to llvm-symbolizer, that prints inlined stack frames.
This should fix PR 14251
llvm-svn: 167721
2012-11-12 11:27:24 +00:00
Dmitry Vyukov
317f39290d
tsan: intercept gettimeofday()
...
llvm-svn: 167630
2012-11-09 19:55:06 +00:00
Alexey Samsonov
ae9b18b607
[Sanitizer] add sanity checks for communication with external symbolizer
...
llvm-svn: 167617
2012-11-09 14:45:30 +00:00
Dmitry Vyukov
805006b0ab
tsan: switch to new memory_order constants (ABI compatible)
...
llvm-svn: 167614
2012-11-09 14:11:51 +00:00
Dmitry Vyukov
4e5f72d380
tsan: add __tsan_atomicX_compare_exchange_val() function
...
It's easier to call from compiler module.
llvm-svn: 167611
2012-11-09 12:54:37 +00:00
Alexander Potapenko
4b8e32de12
Add a possible underscore before the wrappers to the output expectations for Darwin
...
llvm-svn: 167610
2012-11-09 11:55:33 +00:00
Alexey Samsonov
75fb677fd1
[Sanitizer] Build all sanitizer runtime libraries with debug info (with -gline-tables-only, if it's available)
...
llvm-svn: 167584
2012-11-08 14:49:28 +00:00
Dmitry Vyukov
26216e4ae3
tsan: add range access functions for Go
...
llvm-svn: 167580
2012-11-08 13:38:45 +00:00
Alexey Samsonov
37119db20a
[ASan] avoid including <new> header in ASan runtime
...
llvm-svn: 167579
2012-11-08 13:31:19 +00:00
Dmitry Vyukov
e829b6231a
tsan: change TSAN_OPTIONS->GORACE in build script as well
...
llvm-svn: 167578
2012-11-08 13:23:13 +00:00
Alexey Samsonov
c463f3077e
[Sanitizer] try to fix Windows bot - include stdlib.h for abort/_exit functions
...
llvm-svn: 167577
2012-11-08 13:08:41 +00:00
Dmitry Vyukov
9952b674ca
tsan: use GORACE env for options for Go
...
llvm-svn: 167575
2012-11-08 11:32:40 +00:00
Dmitry Vyukov
67dc5702f8
tsan: do not sleep at exit if there are no other threads
...
llvm-svn: 167533
2012-11-07 16:41:57 +00:00
Dmitry Vyukov
ea4f1990e1
tsan: add flag to suppress all reports (useful for benchmarking)
...
llvm-svn: 167532
2012-11-07 16:14:12 +00:00
Dmitry Vyukov
e11f2920c9
tsan: more precise handling of finalizers
...
llvm-svn: 167530
2012-11-07 15:08:20 +00:00
Dmitry Vyukov
da78be74f3
tsan: slightly relax requirements for lazy shadow memory (can overlap and may not be properly aligned)
...
it's problematic on windows where allocation granularity is much larger than page size
llvm-svn: 167466
2012-11-06 16:48:46 +00:00
Dmitry Vyukov
c015712992
tsan: lazily allocate shadow for Go
...
llvm-svn: 167464
2012-11-06 16:00:16 +00:00
Dmitry Vyukov
e86c632015
tsan: fix debug output
...
llvm-svn: 167463
2012-11-06 15:54:34 +00:00
Dmitry Vyukov
a0be3e2c68
tsan: better diagnostics for failed mmap()
...
llvm-svn: 167462
2012-11-06 15:39:16 +00:00
Dmitry Vyukov
95b9a362ff
tsan: fix compiler warning
...
llvm-svn: 167458
2012-11-06 14:05:20 +00:00
Dmitry Vyukov
e4c2fd4c2f
tsan: windows platform support
...
llvm-svn: 167457
2012-11-06 13:35:02 +00:00
Dmitry Vyukov
7234a5b54d
tsan: update script to support windows
...
llvm-svn: 167456
2012-11-06 13:32:53 +00:00
Dmitry Vyukov
5f93416c94
tsan: add shadow mapping for windows
...
llvm-svn: 167455
2012-11-06 13:26:57 +00:00
Dmitry Vyukov
ee563c10c6
tsan: add missing function for windows
...
llvm-svn: 167454
2012-11-06 13:25:05 +00:00
Dmitry Vyukov
1d4120b210
tsan: fix constant types
...
llvm-svn: 167453
2012-11-06 13:21:06 +00:00
Dmitry Vyukov
0ff6d2dd6c
tsan: windows: less includes, better diagnostics for failed VirtualAlloc(), implement sched_yield()
...
llvm-svn: 167452
2012-11-06 13:19:59 +00:00
Dmitry Vyukov
ba827dfdae
tsan: don't release disabled clocks
...
llvm-svn: 167451
2012-11-06 13:16:25 +00:00
Dmitry Vyukov
2817639411
tsan: define missing compier macros for windows
...
llvm-svn: 167450
2012-11-06 12:54:16 +00:00
Dmitry Vyukov
e9bafdf5b8
tsan: fix non-msvc windows build
...
llvm-svn: 167449
2012-11-06 12:50:13 +00:00
Dmitry Vyukov
04dd4b7349
tasn: improve sanitizer_internal_defs.h
...
The file uses namespaces and extern "LANG", so it's kinda senseless to use #ifdef __cplusplus
llvm-svn: 167448
2012-11-06 12:49:22 +00:00
Dmitry Vyukov
e6b5a696e3
tsan: fix windows build
...
__declspec is not _WIN32, it's _MSC_VER
llvm-svn: 167447
2012-11-06 12:47:42 +00:00
Dmitry Vyukov
1ec08f3627
tsan: fix Go build
...
llvm-svn: 167446
2012-11-06 12:46:26 +00:00
Richard Smith
77930919ad
Update compiler-rt tests to match flag renaming/deprecation in Clang.
...
llvm-svn: 167434
2012-11-06 02:31:42 +00:00
Alexey Samsonov
58358897a3
[Sanitizer] Add internal_isatty to sanitizer_libc and PrintsToTty to determine whether error reports are printed to terminal
...
llvm-svn: 167298
2012-11-02 15:18:34 +00:00
Alexey Samsonov
f7a24c4e2b
[Sanitizer] fix printf unittest on 32-bit arch
...
llvm-svn: 167297
2012-11-02 14:28:17 +00:00
Alexey Samsonov
008274440a
[Sanitizer] move unit test for Printf from tsan to sanitizer_common
...
llvm-svn: 167296
2012-11-02 12:36:11 +00:00
Alexey Samsonov
ad9d65feb8
[TSan] finally remove TsanPrintf in favor of Printf from sanitizer_common
...
llvm-svn: 167294
2012-11-02 12:17:51 +00:00
Alexey Samsonov
20ba98fdb1
[Sanitizer] Use kStderrFd constant instead of hardcoded 2
...
llvm-svn: 167291
2012-11-02 09:38:47 +00:00
Alexey Samsonov
fd67c83e7e
[Sanitizer]: add __sanitizer_set_report_fd function to alter file descriptor for error reports
...
llvm-svn: 167290
2012-11-02 09:23:36 +00:00
Alexey Samsonov
0c8b755839
Flag -ccc-clang-cxx was removed in r166986, remove it from compiler-rt lit configs
...
llvm-svn: 167010
2012-10-30 10:06:42 +00:00
Richard Smith
8f4d7eb518
Consistently declare 'extern "C"' variable in namespace __ubsan. No functionality change.
...
llvm-svn: 166966
2012-10-29 21:01:59 +00:00
Richard Smith
f0aac0b99e
Don't define an extern "C" variable in its first declaration, to appease a
...
bogus gcc warning. Take this opportunity to move the declaration to the header,
since it's part of the API of this file.
llvm-svn: 166965
2012-10-29 20:54:34 +00:00
Alexander Potapenko
dda4f0b593
Fix a compiler warning in internal_memmove.
...
llvm-svn: 166775
2012-10-26 13:47:36 +00:00
Alexander Potapenko
2a1925852d
Fix the internal_memmove() implementation that used to skip src[0] if dst < src.
...
llvm-svn: 166774
2012-10-26 13:24:20 +00:00
Alexey Samsonov
23b9199776
[ASan] don't run hacky test for __asan_get_free_bytes() on 32-bits
...
llvm-svn: 166771
2012-10-26 12:10:24 +00:00
Alexander Potapenko
99843d3a29
In the dynamic runtime on Mac OS, do not call internal_strdup() before __asan_init().
...
This may result in a crash at startup.
Fixes http://code.google.com/p/address-sanitizer/issues/detail?id=123 .
llvm-svn: 166768
2012-10-26 11:31:14 +00:00
Richard Smith
2f0d7d564c
-fcatch-undefined-behavior checking for appropriate vptr value: library side.
...
llvm-svn: 166660
2012-10-25 02:07:02 +00:00
Evgeniy Stepanov
64579da1a7
Build ASan runtime for ARM/Android.
...
llvm-svn: 166559
2012-10-24 14:03:41 +00:00
Alexander Potapenko
1eef2b813c
[ASan] Rename ReplaceCFAllocator to MaybeReplaceCFAllocator.
...
Replace the allocator only if the replace_cfallocator flag is set (in some cases it wasn't checked)
llvm-svn: 166550
2012-10-24 09:35:23 +00:00
Alexander Potapenko
faa9c86fd0
[ASan] Use internal_memmove() in both static and dynamic runtime libraries if asan_inited != 0.
...
llvm-svn: 166549
2012-10-24 09:19:16 +00:00
Alexey Samsonov
cea6239219
[ASan] Due to data races, ASan malloc stats are inaccurate, which may cause certain ASan interface functions returning negative values (casted to unsigned). Return a reasonable value if such a case is detected.
...
llvm-svn: 166548
2012-10-24 09:19:11 +00:00
Alexey Samsonov
555d1c5ab8
[ASan] add comment to blacklist file to test behavior introduced in r166283
...
llvm-svn: 166284
2012-10-19 15:26:48 +00:00
Alexey Samsonov
521309294f
[ASan] instrumented asan unit tests should depend on blacklist file
...
llvm-svn: 166282
2012-10-19 15:18:14 +00:00
Bob Wilson
201bf679b2
Fix comment typo.
...
llvm-svn: 166246
2012-10-18 23:08:23 +00:00
Evgeniy Stepanov
ad18287e56
[asan] Disable new/delete interceptors on Android and make them visible elsewhere.
...
llvm-svn: 166180
2012-10-18 15:22:08 +00:00
Alexey Samsonov
b9fdf27357
[Sanitizer] fall back to online symbolizer if user-provided callback failed
...
llvm-svn: 166177
2012-10-18 11:46:22 +00:00
Chandler Carruth
580916eacb
Re-enable this test now that r166172 has hacked around the terrible
...
limitations of the pass manager stack in the pass manager builder.
llvm-svn: 166173
2012-10-18 08:06:28 +00:00
Daniel Dunbar
e5e1c643df
build/clang_darwin: Don't try to build ARM contents on 10.6.
...
- The cctools' ranlib on 10.6 has a bug and can't understand our ARM object
files.
llvm-svn: 166114
2012-10-17 18:33:43 +00:00
Daniel Dunbar
b02dcec79e
build/make: There is no need to put timestamps into .dir files, and it just
...
makes trees less comparable.
llvm-svn: 166111
2012-10-17 18:21:21 +00:00
Alexey Samsonov
5f1a7589ad
[ASan] unit tests: Move main() to a separate file. Fix lint
...
llvm-svn: 166104
2012-10-17 14:04:57 +00:00
Kostya Serebryany
9ced62d195
[asan] added a test for a bug in asan at -O0 introduced by r165936 (making asan a FunctionPass). The test is not actually enabled for -O0 yet (since it fails)
...
llvm-svn: 166103
2012-10-17 13:42:04 +00:00
Alexey Samsonov
7b52cb9e6d
[ASan] Fix strchr/index tests for users who have 'char* strchr(char*,int)' instead of 'char* strchr(const char*, int)'
...
llvm-svn: 166101
2012-10-17 13:39:09 +00:00
Alexey Samsonov
4230a4a05a
[ASan] don't use attribute no_address_safety_analysis if it's unknown to compiler
...
llvm-svn: 166099
2012-10-17 13:19:59 +00:00
Alexey Samsonov
68791d162a
[Sanitizer] symbolizer: increase the maximal number of shared libraries to 16K
...
llvm-svn: 166098
2012-10-17 13:12:23 +00:00
Kostya Serebryany
05a3b01d4f
[asan] fix gcc warnings while building asan-rt
...
llvm-svn: 166093
2012-10-17 08:50:53 +00:00
Alexander Potapenko
e3e80d607f
Do not call ReplaceCFAllocator() before __CFInitialize(), otherwise crashes are possible on 10.8.
...
Fixes http://code.google.com/p/address-sanitizer/issues/detail?id=122
llvm-svn: 166029
2012-10-16 16:58:10 +00:00
Alexander Potapenko
5109e3ef88
Commit a leftover file from r166026: Add MACOS_VERSION_MOUNTAIN_LION.
...
llvm-svn: 166028
2012-10-16 16:48:51 +00:00
Alexander Potapenko
4a78e1002d
Add MACOS_VERSION_MOUNTAIN_LION.
...
llvm-svn: 166026
2012-10-16 16:24:49 +00:00
Kostya Serebryany
278bd2e3a3
[asan] fix lint
...
llvm-svn: 166006
2012-10-16 04:50:32 +00:00
Daniel Dunbar
345b09cb80
platform/clang_darwin: Drop an x86_64 slice into cc_kext_ios5.
...
- This doesn't get used, but it is a simple workaround for PR14013.
llvm-svn: 165987
2012-10-15 22:23:34 +00:00
Daniel Dunbar
ccd312520b
Un-revert r164907 and r164902 (+ follow-ups), 10.6 build fix to follow.
...
llvm-svn: 165986
2012-10-15 22:23:32 +00:00
Nico Weber
926e072016
Revert r164907 and r164902 (+ follow-ups). They broke building on 10.6.
...
See PR14013.
llvm-svn: 165963
2012-10-15 20:37:13 +00:00
Alexander Potapenko
7b03290c43
Implement internal_memmove.
...
Use internal_memmove() and internal_memcpy() in the memcpy() and memmove() wrappers
when building the dynamic runtime (OS X only), to work around a bug in resolver functions wrapping.
See also http://code.google.com/p/address-sanitizer/issues/detail?id=116
llvm-svn: 165939
2012-10-15 15:34:41 +00:00
Kostya Serebryany
ee112b5d7f
[asan] fix more tests
...
llvm-svn: 165934
2012-10-15 13:30:38 +00:00
Kostya Serebryany
16205cd4fa
[asan] change the asan output slightly to avoid user confusion: a) add ':' after 'AddressSanitizer' and b) changed 'crashed' to 'SEGV'
...
llvm-svn: 165932
2012-10-15 13:04:58 +00:00
Richard Smith
feea5d6fb4
Provide a slightly more helpful diagnostic if -fcatch-undefined-behavior finds
...
a problem with __int128 arithmetic but the runtime was not built with __int128
support.
llvm-svn: 165913
2012-10-14 23:53:37 +00:00
Richard Smith
130b748b72
Use a better test for __int128 support, which works on old GCC versions.
...
llvm-svn: 165912
2012-10-14 23:28:55 +00:00
Chandler Carruth
eea8a48218
Fix the bootstrap of CompilerRT with host compilers that don't support
...
emulating 128-bit arithmetic on 32-bit x86 targets. This should get the
bootstrap back for GCC 4.6 at least.
Suggestions on better ways to do the detection here are welcome...
llvm-svn: 165863
2012-10-13 02:30:10 +00:00
Richard Smith
7247b23efc
-fcatch-undefined-behavior: Runtime library support for trapping conversions to or
...
from a floating-point type where the source value is not in the range of
representable values of the destination type.
llvm-svn: 165844
2012-10-12 22:57:15 +00:00
Richard Smith
22cc16462e
-fcatch-undefined-behavior: handler for VLA bound which evaluates to a non-positive value.
...
llvm-svn: 165582
2012-10-10 01:10:59 +00:00
Richard Smith
b6fb381dba
-fcatch-undefined-behavior: store the type name directly at the end of a type descriptor. 5% binary size reduction due to fewer relocations.
...
llvm-svn: 165571
2012-10-09 23:55:18 +00:00
Richard Smith
68b3014cd3
Add a runtime diagnostics library for Clang's -fcatch-undefined-behavior.
...
llvm-svn: 165533
2012-10-09 19:34:32 +00:00
Alexey Samsonov
7b6ce747d6
Determine supported archs for compiler-rt libraries on Linux by trying to compile a simple executable
...
llvm-svn: 165504
2012-10-09 16:05:50 +00:00
Alexey Samsonov
83ecabe6e6
[Sanitizer] Remove unneeded returns after UNIMPLEMENTED macro
...
llvm-svn: 165493
2012-10-09 08:51:08 +00:00
Alexey Samsonov
3a0a88fe0a
[Sanitizer] Add UNREACHABLE(msg) macro
...
llvm-svn: 165492
2012-10-09 08:42:07 +00:00
Alexey Samsonov
480477c0e1
[ASan] use llvm-symbolizer for ASan lit-style tests on Mac
...
llvm-svn: 165391
2012-10-08 13:11:18 +00:00
Alexey Samsonov
0111f55eac
llvm-symbolizer for Mac: add support for reading DWARF from separate object file in resource directory generated by dsymutil. Fix minor symbol table lookup issues.
...
llvm-svn: 165389
2012-10-08 10:17:44 +00:00
Dmitry Vyukov
19ba50a8b9
tsan: better message about found races for Go ThreadSanitizer
...
llvm-svn: 165376
2012-10-07 14:21:24 +00:00
Dmitry Vyukov
90c9cbfed4
tsan: cache pc's that cause suppressions (this way we do not need to symbolize the reports)
...
llvm-svn: 165317
2012-10-05 15:51:32 +00:00
Alexander Potapenko
b4db79fc7d
If !asan_inited, call internal versions of libc functions where available.
...
This is to remove unnecessary #if directives.
llvm-svn: 165307
2012-10-05 12:11:06 +00:00
Dmitry Vyukov
6d5bd599c2
tsan for Go: support mallocs before __tsan_init() (required to support cgo code)
...
llvm-svn: 165229
2012-10-04 13:54:49 +00:00
Alexander Potapenko
d2f6b97417
Avoid calling __asan_init from memcpy(), memmove(), memset() during libSystem initialization.
...
Fixes http://code.google.com/p/address-sanitizer/issues/detail?id=117 .
llvm-svn: 165227
2012-10-04 13:41:28 +00:00
Alexey Samsonov
3197f8e6cb
[ASan] don't build 64-bit runtime on 32-bit Linux platforms
...
llvm-svn: 165222
2012-10-04 12:22:33 +00:00
Dmitry Vyukov
b96a7b5aa5
tsan: add atomic_fetch_sub() and atomic_signal_fence() functions
...
llvm-svn: 165218
2012-10-04 10:08:23 +00:00
Kostya Serebryany
cb13fff13d
[asan] properly report mmap failure
...
llvm-svn: 165214
2012-10-04 07:21:09 +00:00
Bill Wendling
836d53015e
I'm getting these errors with r165159:
...
/Users/void/llvm/llvm-tot.src/projects/compiler-rt/lib/arm/eqdf2vfp.S:22:2: error: instruction requires: VFP2
vmov d6, r0, r1
^
/Users/void/llvm/llvm-tot.src/projects/compiler-rt/lib/arm/eqdf2vfp.S:23:2: error: instruction requires: VFP2
vmov d7, r2, r3
^
/Users/void/llvm/llvm-tot.src/projects/compiler-rt/lib/arm/eqdf2vfp.S:24:2: error: instruction requires: VFP2
vcmp.f64 d6, d7
^
/Users/void/llvm/llvm-tot.src/projects/compiler-rt/lib/arm/eqdf2vfp.S:25:2: error: instruction requires: VFP2
vmrs apsr_nzcv, fpscr
^
llvm-svn: 165191
2012-10-04 01:44:41 +00:00
Bob Wilson
1ff65860e4
Back out my temporary workaround for Apple buildbots.
...
--- Reverse-merging r164909 into '.':
U make/platform/clang_darwin.mk
llvm-svn: 165159
2012-10-03 21:03:42 +00:00
Alexander Potapenko
0f0a50da56
Set ASAN_NEEDS_SEGV=0 on Android only.
...
llvm-svn: 165120
2012-10-03 15:09:17 +00:00
Dmitry Vyukov
be6878365d
tsan: prepare for migration to new memory_order enum values (ABI compatible)
...
llvm-svn: 165106
2012-10-03 13:00:13 +00:00
Alexey Samsonov
c561ce0e01
Build ASan runtime on Linux for both x86_64 and i386, same as we do with full compiler_rt and libprofile
...
llvm-svn: 165096
2012-10-03 07:16:31 +00:00
Alexander Potapenko
77c0ac2336
Do not patch the instruction address when symbolizing the reports.
...
Instead, print the correct address at runtime.
llvm-svn: 165018
2012-10-02 15:42:24 +00:00
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