Commit Graph

6509 Commits

Author SHA1 Message Date
Mike Aizatsky 6e9b970805 .clang-tidy for sanitizer package to override root llvm style
Summary:
sanitizer-common follows Google code style, override
clang-tidy config.

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

llvm-svn: 258449
2016-01-21 23:21:31 +00:00
Xinliang David Li 8b1f80779b Resubmit test case with more restriction
The original submittion triggered a BFD linker bug (2.24) on Aarch64 only. Before
the build bot is upgraded to more recent linker, restrict the test to be 
executed only with gold linker.

llvm-svn: 258437
2016-01-21 21:59:19 +00:00
Alexey Samsonov c8adcb4af6 [MSan] Add a test case for r258339.
llvm-svn: 258413
2016-01-21 17:51:08 +00:00
Alexey Samsonov 25f5913ddf [MSan] Clear parameters shadow before invoking malloc/free hooks.
MSan runtime is not itself instrumented, so we need to explicitly
clear shadow for function arguments before calling user-provided
functions from runtime (e.g. we already do this for several
interceptors).

I'm still crafting a test case that would demonstrate this issue
reliably, and will commit it later today.

llvm-svn: 258339
2016-01-20 19:56:04 +00:00
Kostya Serebryany af69f1c690 [asan] print an additional hint when reporting a container overflow
llvm-svn: 258337
2016-01-20 19:49:12 +00:00
Renato Golin 533c32bdda Revert "[coverage] Add a test case to cover coverage testing with comdat"
This reverts commit r258255 and r258274, as it was breaking the AArch64 bot.

llvm-svn: 258314
2016-01-20 14:27:50 +00:00
Vedant Kumar 0b9df44cf1 [test] Add a short explanation to instrprof-comdat.h
llvm-svn: 258274
2016-01-20 02:31:25 +00:00
Xinliang David Li 6900596040 [coverage] Add a test case to cover coverage testing with comdat
llvm-svn: 258255
2016-01-20 00:11:36 +00:00
Mike Aizatsky 7d866cb145 using const instead of constexpr: MSVC troubles
llvm-svn: 258253
2016-01-19 23:46:27 +00:00
Mike Aizatsky dba78e676f [sancov] NFC: simplifying DumpOffsets.
Summary: Extracting GetRangeOffset function before report-on-dump
functionality.

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

llvm-svn: 258211
2016-01-19 22:47:38 +00:00
Nico Weber 72f564f818 Fix another -Wexpansion-to-defined warning in compiler-rt.
llvm-svn: 258202
2016-01-19 22:07:55 +00:00
Nico Weber 82210fbc1e Fix -Wexpansion-to-defined warnings in compiler-rt.
llvm-svn: 258200
2016-01-19 22:02:12 +00:00
Dmitry Vyukov f8f2d46002 tsan: add back __tls_get_addr interceptor
Removal of the interceptor broke libtsan interface in gcc:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68824
Add back a simple interceptor.

llvm-svn: 258119
2016-01-19 12:28:00 +00:00
Maxim Ostapenko 1965cc6258 [asan] Optionally print reproducer cmdline in ASan reports.
Differential Revision: http://reviews.llvm.org/D16070

llvm-svn: 258037
2016-01-18 07:55:12 +00:00
Yabin Cui f7ebaf889a [tsan] Do nothing in ScopedInterceptor's destructor if thr is not inited.
Summary:
It is part of http://reviews.llvm.org/D15301, but missed when I committed
that patch.

Reviewers: kubabrecka, kcc, eugenis, llvm-commits, dvyukov

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

llvm-svn: 258021
2016-01-17 21:33:42 +00:00
Peter Collingbourne f5571f5248 Fix stats.cpp test on 32-bit Windows.
llvm-svn: 257981
2016-01-16 02:08:55 +00:00
Peter Collingbourne d73cd4ab01 Attempt to fix sanitizer-windows bot.
llvm-svn: 257978
2016-01-16 01:15:19 +00:00
Alexey Samsonov 95cd990588 [LSan] Ignore all allocations made inside pthread_create.
Thread stack/TLS may be stored by libpthread for future reuse after
thread destruction, and the linked list it's stored in doesn't
even hold valid pointers to the objects, the latter are calculated
by obscure pointer arithmetic.

With this change applied, LSan test suite passes with
"use_ld_allocations" flag defaulted to "false". It still requires more
testing to check if the default can be switched.

llvm-svn: 257975
2016-01-16 00:57:25 +00:00
Peter Collingbourne 5788e1259b Introduce stats and stats_client libraries.
This is part of a new statistics gathering feature for the sanitizers.
See clang/docs/SanitizerStats.rst for further info and docs.

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

llvm-svn: 257972
2016-01-16 00:31:29 +00:00
Nico Weber 230af4047d Re-disable suppressions.cpp on Windows.
See discussion in http://reviews.llvm.org/D15363

llvm-svn: 257952
2016-01-15 23:19:39 +00:00
Yabin Cui 19e8c0e2f7 [tsan] Fix some tiny errors.
Summary:
1. Fix spell error for sigaction.
2. Make line_length <= 80.

Reviewers: llvm-commits, eugenis, kcc, dvyukov

Subscribers: tberghammer, danalbert, srhines

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

llvm-svn: 257872
2016-01-15 06:21:46 +00:00
Yabin Cui bd3a772e9f [tsan] Store the pointer to ThreadState in TLS slot on Android.
Summary:
1. Android doesn't support __thread keyword. So allocate ThreadState
dynamically and store its pointer in one TLS slot provided by Android.
2. On Android, intercepted functions can be called before ThreadState
is initialized. So add test of thr_->is_inited in some places.
3. On Android, intercepted functions can be called after ThreadState
is destroyed. So add a fake dead_thread_state to represent all
destroyed ThreadStates. And that is also why we don't store the pointer
to ThreadState in shadow memory of pthread_self().

Reviewers: kcc, eugenis, dvyukov

Subscribers: kubabrecka, llvm-commits, tberghammer, danalbert, srhines

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

llvm-svn: 257866
2016-01-15 03:39:04 +00:00
Yabin Cui 66e5db99b3 [tsan] Use internal_sigfillset to replace REAL(sigfillset).
Summary:
Android doesn't intercept sigfillset, so REAL(sigfillset) is null.
And we can use internal_sigfillset() for all cases.

Reviewers: kcc, eugenis, kubabrecka, dvyukov

Subscribers: llvm-commits, tberghammer, danalbert

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

llvm-svn: 257862
2016-01-15 02:59:23 +00:00
Peter Collingbourne d2f24b62b5 Unbreak Windows build.
llvm-svn: 257860
2016-01-15 02:51:26 +00:00
Peter Collingbourne b825bf32b7 sanitizer_common: C++ify the IntrusiveList iterator interface.
llvm-svn: 257858
2016-01-15 02:19:20 +00:00
Alexey Samsonov 1f242d6a77 [LSan] Add "use_ld_allocations" flag to disable old way of DTLS handling.
This flag allows to disable old way of determining dynamic TLS by
filtering out allocations from dynamic linker. This will be eventually
superseded by __tls_get_addr interceptor (see r257785), after we:
1) Test it in several supported environments
2) Deal with existing problems (currently we can't find a pointer to
  DTV which is calloc()-ed in pthread_create).

llvm-svn: 257789
2016-01-14 19:16:05 +00:00
Alexey Samsonov 5535c51606 [LSan] Use __tls_get_addr interceptor to keep track of dynamic TLS.
Summary:
We have a way to keep track of allocated DTLS segments: let's use it
in LSan. Although this code is fragile and relies on glibc
implementation details, in some cases it proves to be better than
existing way of tracking DTLS in LSan: marking as "reachable" all
memory chunks allocated directly by "ld".

The plan is to eventually get rid of the latter, once we are sure
it's safe to remove.

Reviewers: kcc

Subscribers: llvm-commits

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

llvm-svn: 257785
2016-01-14 18:50:09 +00:00
Sumanth Gundapaneni b76bf106b1 Fix the cross compilation of unit tests. NFC (second attempt)
With COMPILER_RT_INCLUDE_TESTS turned ON and in a cross compiling
environment, the unit tests fail to link. This patch does the following changes

>Rename COMPILER_RT_TEST_CFLAGS to COMPILER_RT_UNITTEST_CFLAGS to reflect the 
way it's used.
>Add COMPILER_RT_TEST_COMPILER_CFLAGS to COMPILER_RT_UNITTEST_CFLAGS so 
that cross-compiler would be able to build/compile the unit tests
>Add COMPILER_RT_UNITTEST_LINKFLAGS to COMPILER_RT_UNITTEST_CFLAGS so 
that cross-compiler would be able to link the unit tests (if needed)

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

llvm-svn: 257783
2016-01-14 18:18:49 +00:00
Xinliang David Li 944cd4d318 [Coverage] add test cases for coverage testing
1. One test covering coverage-mapping interfaction with linker GC
2. one test covering coverage-mapping with shared libaries

llvm-svn: 257782
2016-01-14 18:15:54 +00:00
Kuba Brecka 0626dd0d3b [tsan] Introduce a "ignore_interceptors_accesses" option
On OS X, TSan already passes all unit and lit tests, but for real-world applications (even very simple ones), we currently produce a lot of false positive reports about data races. This makes TSan useless at this point, because the noise dominates real bugs. This introduces a runtime flag, "ignore_interceptors_accesses", off by default, which makes TSan ignore all memory accesses that happen from interceptors. This will significantly lower the coverage and miss a lot of bugs, but it eliminates most of the current false positives on OS X.

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

llvm-svn: 257760
2016-01-14 12:24:37 +00:00
Kuba Brecka 9f5fde7081 [tsan] Fix the value of PTHREAD_MUTEX_RECURSIVE for OS X and FreeBSD
The value of the constant PTHREAD_MUTEX_RECURSIVE is not "1" on FreeBSD and OS X.

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

llvm-svn: 257758
2016-01-14 12:12:58 +00:00
Xinliang David Li c6615cdce5 sync up with master file
llvm-svn: 257746
2016-01-14 06:23:53 +00:00
Alexey Samsonov 38b3130c7a [Sanitizer] Pass proper values to DTLS_on_libc_memalign.
Fix a surprising typo: the old code used to think that dynamic TLS
segments were several times larger than they actually are.

llvm-svn: 257722
2016-01-14 00:04:37 +00:00
Hans Wennborg 7b9d2b6c87 Revert r257686 "With COMPILER_RT_INCLUDE_TESTS turned ON and in a cross compiling"
This broke the build. For example, from
http://lab.llvm.org:8011/builders/clang-cmake-aarch64-full/builds/1191/steps/cmake%20stage%201/logs/stdio:

	-- Compiler-RT supported architectures: aarch64
	CMake Error at projects/compiler-rt/cmake/Modules/AddCompilerRT.cmake:170 (string):
		string sub-command REPLACE requires at least four arguments.
	Call Stack (most recent call first):
		projects/compiler-rt/lib/CMakeLists.txt:4 (include)

llvm-svn: 257694
2016-01-13 22:50:24 +00:00
Sumanth Gundapaneni 2d2f2b5c80 With COMPILER_RT_INCLUDE_TESTS turned ON and in a cross compiling
environment, the unit tests fail to link. This patch does the following changes

>Rename COMPILER_RT_TEST_CFLAGS to COMPILER_RT_UNITTEST_CFLAGS to reflect the 
way it's used.
>Add COMPILER_RT_TEST_COMPILER_CFLAGS to COMPILER_RT_UNITTEST_CFLAGS so that 
cross-compiler would be able to build/compile the unit tests
>Add COMPILER_RT_UNITTEST_LINKFLAGS to COMPILER_RT_UNITTEST_CFLAGS so that 
cross-compiler would be able to link the unit tests (if needed)

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

llvm-svn: 257686
2016-01-13 22:09:47 +00:00
Dan Gohman 746cd84e3c [WebAssembly] Enable the builtins library for WebAssembly.
llvm-svn: 257619
2016-01-13 16:56:15 +00:00
Dan Gohman 01731fc150 [WebAssembly] clang supports int128_t on wasm32 in addition to wasm64.
llvm-svn: 257618
2016-01-13 16:47:51 +00:00
Dmitry Vyukov 529b940a77 tsan: check errors in test
Somebody reported flakiness of this test.
Let's start by checking errors.

llvm-svn: 257585
2016-01-13 10:14:05 +00:00
Chris Bieneman 1a4ae60f5a [CMake] Adding experimental support for tvOS and watchOS
Summary:
* Refactored the iOS config-ix.cmake code to be a more compact loop over supported embedded platforms.
* Added watchOS and tvOS as experimental platforms, they don't currently build so they are disabled by default

Reviewers: zaks.anna, kubabrecka, samsonov

Subscribers: llvm-commits

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

llvm-svn: 257544
2016-01-12 23:51:03 +00:00
Adhemerval Zanella c52448872b [compiler-rt] [msan] Remove stable-runtime requirement for insertvalue_origin.cc
This patch removes the requirement on stable-runtime on insertvalue_origin.cc
testcase, added due a instrumentation failure on aarch64-linux. This is fixed
on llvm code by r257375.

llvm-svn: 257479
2016-01-12 15:16:34 +00:00
Xinliang David Li 31ad54298e [PGO] Add Linux specific test cases for profile runtime
(second try with more strict config check)
Currently, only gc-sections related tests are added. Gold
linker currently is required due to PR19161 of bfd linker.

llvm-svn: 257456
2016-01-12 07:18:53 +00:00
Xinliang David Li 452f1a5576 Revert r257444 : arm build bots failure
llvm-svn: 257446
2016-01-12 05:39:26 +00:00
Xinliang David Li cfefae8a14 [PGO] Add Linux specific test cases for profile runtime
Currently, only gc-sections related tests are added. Gold
linker currently is required due to PR19161 of bfd linker.

llvm-svn: 257444
2016-01-12 04:54:24 +00:00
Xinliang David Li 385612c5b4 Fix comment of test
llvm-svn: 257443
2016-01-12 03:57:14 +00:00
Kostya Serebryany e3580956ea [libFuzzer] extend the weak memcmp/strcmp/strncmp interceptors to receive the result of the computations. With that, don't do any mutations if memcmp/etc returned 0
llvm-svn: 257423
2016-01-12 00:43:42 +00:00
Evgeniy Stepanov 6742d75952 [cfi] Fix __cfi_slowpath and __cfi_check signature.
The first argument is uint64_t, not uintptr_t.

llvm-svn: 257233
2016-01-08 23:42:30 +00:00
Xinliang David Li d85c32cdfa Fix typo in comment
llvm-svn: 257232
2016-01-08 23:42:28 +00:00
Xinliang David Li a692421adb [PGO] Add runtime hook so that IR instrumentation can override version
IR level instrumentation needs to override version with variant bits.
No change for FE instrumentation is needed. Test case is added to
detect version mismatch.

llvm-svn: 257230
2016-01-08 23:31:57 +00:00
Xinliang David Li f5a58834c1 [PGO] Introducing version mask macro/NFC (sync)
llvm-svn: 257225
2016-01-08 22:55:54 +00:00
Kostya Serebryany abc2c998d2 [tsan] don't crash on closedir(0)
llvm-svn: 257223
2016-01-08 22:48:19 +00:00