Commit Graph

4553 Commits

Author SHA1 Message Date
Dmitry Vyukov 8bbb17dcc3 tsan: disable getpwent interceptors
There interceptors do not seem to be strictly necessary for tsan.
But we see cases where the interceptors consume 70% of execution time.
Memory blocks passed to fgetgrent_r are "written to" by tsan several times.
First, there is some recursion (getgrnam_r calls fgetgrent_r), and each
function "writes to" the buffer. Then, the same memory is "written to"
twice, first as buf and then as pwbufp (both of them refer to the same addresses).

llvm-svn: 216904
2014-09-02 12:51:11 +00:00
Dmitry Vyukov 1841219abd tsan: restructure signal handling to allow recursive handling
Fixes issue
https://code.google.com/p/thread-sanitizer/issues/detail?id=71

llvm-svn: 216903
2014-09-02 12:27:45 +00:00
Dmitry Vyukov dc1caa7cb8 tsan: address comments in r214912
See http://reviews.llvm.org/D4794

llvm-svn: 216900
2014-09-02 09:34:34 +00:00
Alexander Potapenko 3ae9193371 [libsanitizer] Fix the Android build.
llvm-svn: 216885
2014-09-01 15:38:16 +00:00
Evgeniy Stepanov 21202ba8dd [asan] Update asan_device_setup to support Android L Preview.
llvm-svn: 216884
2014-09-01 15:37:50 +00:00
Alexander Potapenko a909e493f1 [libsanitizer] Make sanitizer_unwind_posix.cc a libcdep source file.
Guard the source with #if SANITIZER_POSIX to fix compilation on Windows.
use it only in 

llvm-svn: 216882
2014-09-01 13:07:50 +00:00
Dmitry Vyukov 34fb3799a3 tsan: fix false positive related to signal handlers
Users expect synchronization between sigaction and arrival
of the signal. See the test for details.

llvm-svn: 216878
2014-09-01 12:46:42 +00:00
Alexander Potapenko 4d84996186 [ASan] Small refactoring - split the slow unwinding logic into sanitizer_unwind_posix.cc
This allows the slow unwinder to be used on OSX (it's disabled for now, see
https://code.google.com/p/address-sanitizer/issues/detail?id=137 for details)

llvm-svn: 216877
2014-09-01 12:43:03 +00:00
Dmitry Vyukov aa8fa60ba8 tsan: unbreak windows build
Currently it fails with:

# Testing race detector.
race_windows_amd64.syso:gotsan.cc:(.text+0x4d89): undefined reference to `__imp_SymGetModuleBase64'
race_windows_amd64.syso:gotsan.cc:(.text+0x4d90): undefined reference to `__imp_SymFunctionTableAccess64'
race_windows_amd64.syso:gotsan.cc:(.text+0x4dd8): undefined reference to `__imp_StackWalk64'
x86_64-w64-mingw32/bin/ld.exe: race_windows_amd64.syso
: bad reloc address 0x10 in section `.data'
collect2.exe: error: ld returned 1 exit status

llvm-svn: 216875
2014-09-01 11:44:59 +00:00
Kostya Serebryany c148f7c3af [asan] enable poison_array_cookie back
llvm-svn: 216705
2014-08-29 01:16:18 +00:00
Kostya Serebryany ac77055272 [asan] introduce __asan_load_cxx_array_cookie: check that the array cookie address is properly poisoned and return the cookie value. If not, return 0 to avoid infinite loop of DTORs (in case of use-after-free). Calls to this function will be inserted by clang (separate change)
llvm-svn: 216692
2014-08-28 22:28:04 +00:00
Kostya Serebryany 1e3b338606 [asan] disable poison_array_cookie while I am investigating a false positive on chromium (I suspect that LLVM looses nosanitizer metadata; no test yet)
llvm-svn: 216684
2014-08-28 20:24:05 +00:00
Timur Iskhodzhanov f77d20b1a9 [ASan/Win] Add a test case for r216663 [-Zl vs LIBCMT vs asan_win_uar_thunk]
llvm-svn: 216665
2014-08-28 13:20:23 +00:00
Timur Iskhodzhanov 737370da20 [ASan/Win] Add the -Zl flag to avoid /DEFAULTLIB:libcmt directive in the asan_win_uar_thunk object file
This directive results in 'symbol already defined' when linking DLLs that use -MD

llvm-svn: 216663
2014-08-28 12:28:04 +00:00
Alexander Potapenko 2164fa3b9b [ubsan] Follow-up for r216657: fixed the line numbers in the test.
llvm-svn: 216661
2014-08-28 10:25:17 +00:00
Alexander Potapenko 53cce89a81 [UBSan] Temporarily disable checks for stack traces in UBSan reports on Darwin
to make the tests green.
Slow stack unwinding is disabled in libsanitizer on Darwin now.

llvm-svn: 216657
2014-08-28 09:25:06 +00:00
Alexander Potapenko 83061238d4 [ASan] Whitespace fix. No functionality change.
llvm-svn: 216544
2014-08-27 13:43:18 +00:00
Evgeniy Stepanov 5d321d759d [asan] Add asprintf negative test.
llvm-svn: 216542
2014-08-27 12:46:58 +00:00
Timur Iskhodzhanov 6add9fe958 [ASan/Win] Enable building the MD runtime by default
llvm-svn: 216534
2014-08-27 10:17:20 +00:00
Evgeniy Stepanov 8f4e736080 [asan] Restore asan-rt name on linux back to pre-r216380.
There is no reason to have different library names for shared and static
cases on linux. It also breaks Android where we install the shared asan-rt
library into the system and should keep the old name.

This change reverts most of r216380 limiting it to win32 targets only.

llvm-svn: 216533
2014-08-27 09:46:54 +00:00
Kostya Serebryany 9455c5ab81 [asan] add a test for poison_array_cookie=1
llvm-svn: 216494
2014-08-26 22:05:12 +00:00
Sergey Matveev 08347ca4fd [lsan] Implement the public allocator interface in standalone LSan.
llvm-svn: 216459
2014-08-26 14:28:28 +00:00
Sergey Matveev 93a2906e80 [lsan] Implement __sanitizer_print_stack_trace() in standalone LSan.
llvm-svn: 216454
2014-08-26 12:52:41 +00:00
Timur Iskhodzhanov 47030475a0 [ASan/Win] Disable warning C4391: incorrect return type for intrinsic function
This warning makes it a bit hard to define strlen and wcslen interceptors in an elegant yet portable way

llvm-svn: 216450
2014-08-26 12:33:00 +00:00
Timur Iskhodzhanov 81885731a8 [ASan/Win] Rename asan_dll_thunk.cc to asan_win_dll_thunk.cc
llvm-svn: 216448
2014-08-26 10:21:37 +00:00
Timur Iskhodzhanov 6903e10ddf [ASan/Win] Add an extra thunk.lib to handle stack-use-after-return option
With this patch, "check-asan" passes all the tests with both MT and MD ASan RTL if you set COMPILER_RT_BUILD_SHARED_ASAN to ON
(PR20214)

llvm-svn: 216447
2014-08-26 10:08:24 +00:00
Kostya Serebryany 74bd6bc9f9 [sanitizer] move mlock interceptor from asan/tsan/msan to common; no functionality change intended
llvm-svn: 216407
2014-08-25 20:57:59 +00:00
Timur Iskhodzhanov dc8caada51 [ASan/Win] Add /DEBUG to the MD RTL link flags
llvm-svn: 216387
2014-08-25 16:45:53 +00:00
Timur Iskhodzhanov 2311f4dfaa [ASan] Replace CMake if/APPEND/endif with append_if
llvm-svn: 216386
2014-08-25 16:40:39 +00:00
Timur Iskhodzhanov 0a88b25c43 [ASan/Win] Intercept memory allocation functions in the MD CRT
llvm-svn: 216382
2014-08-25 13:19:05 +00:00
Timur Iskhodzhanov ea3ce790dc [ASan] Rename the ASan dynamic RT
Reviewed at http://reviews.llvm.org/D5026

llvm-svn: 216380
2014-08-25 11:44:06 +00:00
Alexey Samsonov 2ccbc621df [UBSan] Add support for printing backtraces to all UBSan handlers
llvm-svn: 216289
2014-08-22 21:42:04 +00:00
Alexander Potapenko ea2402ebf4 [ubsan] Follow-up for r216263: fix the expected line number.
llvm-svn: 216266
2014-08-22 12:44:16 +00:00
Timur Iskhodzhanov 220ddacf8d [ASan/Win] Land the trivial bits of -MD RTL support (PR20214)
llvm-svn: 216265
2014-08-22 12:38:07 +00:00
Timur Iskhodzhanov f2d24473fe [ASan] Use check_library_exists to determine if libc/libstdc++ are available
llvm-svn: 216264
2014-08-22 12:26:34 +00:00
Alexander Potapenko 66ae9712c5 [ubsan] Do not run Function/function.cpp on Darwin where -fsanitize=function is not supported.
llvm-svn: 216263
2014-08-22 11:09:10 +00:00
Alexander Potapenko 373863d31e Follow-up for r215436: use SIZE_T for strlen and wcslen interceptors.
llvm-svn: 216184
2014-08-21 16:12:46 +00:00
Timur Iskhodzhanov a14ef30443 [ASan] Turns out we should always intercept __cxa_throw
At least check-asan works with this change.

If the change breaks anything, we'll need to add:
a) a comment describing why we have to use INTERCEPT_FUNCTION rather than
   ASAN_INTERCEPT_FUNC
and
b) a test case.

llvm-svn: 216177
2014-08-21 13:33:39 +00:00
Alexey Samsonov 6d2022b2e0 Fix latent bug in try_compile macro and use CMAKE_EXE_LINKER_FLAGS
when testing for supported architectures, as suggested by Andy Gibbs.

llvm-svn: 216083
2014-08-20 17:12:58 +00:00
Peter Collingbourne 82ff058cf9 DFSan's set label function should avoid writing to the shadow memory when the write would not change the value in memory.
When writing a label to shadow memory, don't write if the value is already set to the value being written.  This dramatically reduces real memory consumption in programs with sparse use of labels.

Test Plan: It would be nice to test that unnecessary writes are skipped, but I do not see how a unit test could do this.

Patch by Sam Kerner!

Differential Revision: http://reviews.llvm.org/D4894

llvm-svn: 215961
2014-08-19 01:47:33 +00:00
Alexey Samsonov 2e39027931 [LSan] Parse common flags from LSAN_OPTIONS even if LSan is combined with
another sanitizer.

A user may run both LSan and LSan+ASan. It is weird to pass path to leak
suppression file (or other common sanitizer flags, like "verbosity") in
"LSAN_OPTIONS" in the first case and in "ASAN_OPTIONS" in the second case.

llvm-svn: 215949
2014-08-18 23:39:47 +00:00
Alexey Samsonov 00c02b297a Add regression test for PR15823
llvm-svn: 215941
2014-08-18 22:11:14 +00:00
Alexey Samsonov 591d15272e [TSan] Add -lpthread to the test which uses pthread_ functions
llvm-svn: 215939
2014-08-18 22:09:17 +00:00
Justin Bogner 8da47ac82e profile: Improve error messages on bad GCDA files
llvm-svn: 215933
2014-08-18 20:47:32 +00:00
Hans Wennborg 4834653872 sanitizer_printf.cc: guard the va_copy hack on _MSC_VER
llvm-svn: 215932
2014-08-18 20:23:16 +00:00
Hans Wennborg a2d4b09a55 Revert "[ASan/Win] Remove a hack that seems not to be required with VS2013 anymore" (r215708)
This is still needed for VS2012.

llvm-svn: 215930
2014-08-18 19:55:35 +00:00
Alexey Samsonov cd21e2f7e4 [TSan] Initialize flags as early as possible. Disables back coredump, accidentally enabled in r215479. Add a test.
llvm-svn: 215763
2014-08-15 19:53:51 +00:00
Timur Iskhodzhanov 48e21c07c1 Follow-up to r215724: fix a lint warning
llvm-svn: 215725
2014-08-15 16:10:02 +00:00
Timur Iskhodzhanov 5c84264194 [ASan/Win] Introduce a new macro for malloc-like function attributes; also, clang-format the definitions of these functions
llvm-svn: 215724
2014-08-15 16:08:53 +00:00
Timur Iskhodzhanov 3e00116dc1 [ASan/Win] Remove one more reference to __interception::GetRealFunctionAddress (follow-up to r215707)
llvm-svn: 215722
2014-08-15 15:41:03 +00:00