Commit Graph

4902 Commits

Author SHA1 Message Date
Justin Bogner efa6197ab7 Use the newer python syntax for exceptions
We've dropped support for python 2.5, so now we can use the forward
compatible "except ... as" syntax.

llvm-svn: 224181
2014-12-13 02:46:56 +00:00
Alexey Samsonov 6334f46db8 [Sanitizer] Introduce Allocator::may_return_null bool flag.
Summary:
Turn "allocator_may_return_null" common flag into an
Allocator::may_return_null bool flag. We want to make sure
that common flags are immutable after initialization. There
are cases when we want to change this flag in the allocator
at runtime: e.g. in unit tests and during ASan activation
on Android.

Test Plan: regression test suite, real-life applications

Reviewers: kcc, eugenis

Subscribers: llvm-commits

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

llvm-svn: 224148
2014-12-12 20:07:35 +00:00
Viktor Kutuzov 7163d00359 [Asan] XFAIL the interception_failure_test.cc test on FreeBSD
Differential Revision: http://reviews.llvm.org/D6591

llvm-svn: 224117
2014-12-12 12:13:40 +00:00
Viktor Kutuzov df4dab69e2 [Asan] Fix the tsd_dtor_leak.cc test to pass on FreeBSD
Differential Revision: http://reviews.llvm.org/D6590

llvm-svn: 224116
2014-12-12 12:09:56 +00:00
Kumar Sukhani adb3864744 [mips] [test] Enable COMPILER_RT_INCLUDE_TESTS for MIPS
Enabling COMPILER_RT_INCLUDE_TESTS and updating tests/sanitizer_allocator_test.cc to remove Allocator64 related tests for MIPS.

Reviewed By: samsonov

llvm-svn: 224101
2014-12-12 07:08:12 +00:00
Alexey Samsonov c60042ef8b [ASan] Group all flag parsing code together. NFC.
llvm-svn: 224087
2014-12-12 01:08:24 +00:00
Alexey Samsonov 0545f4b0f3 [ASan] Change fake stack and local variables handling.
This commit changes the way we get fake stack from ASan runtime
(to find use-after-return errors) and the way we represent local
variables:
  - __asan_stack_malloc function now returns pointer to newly allocated
    fake stack frame, or NULL if frame cannot be allocated. It doesn't
    take pointer to real stack as an input argument, it is calculated
    inside the runtime.
  - __asan_stack_free function doesn't take pointer to real stack as
    an input argument. Now this function is never called if fake stack
    frame wasn't allocated.
  - __asan_init version is bumped to reflect changes in the ABI.
  - new flag "-asan-stack-dynamic-alloca" allows to store all the
    function local variables in a dynamic alloca, instead of the static
    one. It reduces the stack space usage in use-after-return mode
    (dynamic alloca will not be called if the local variables are stored
    in a fake stack), and improves the debug info quality for local
    variables (they will not be described relatively to %rbp/%rsp, which
    are assumed to be clobbered by function calls). This flag is turned
    off by default for now, but I plan to turn it on after more
    testing.

llvm-svn: 224063
2014-12-11 21:53:19 +00:00
Alexey Samsonov 2c3045f1b9 [Sanitizer] Don't modify mmap_limit_mb flag in runtime.
Instead, rely on the fact that RAW_CHECK doesn't call mmap(),
and we'll be able to print an error message and kill a program.

llvm-svn: 224034
2014-12-11 18:45:24 +00:00
Alexey Samsonov 3a41ed1574 [Sanitizer] Fix report_path functionality:
Summary:
  - Make sure mmap() is never called inside RawWrite function.
  - Wrap a bunch of standalone globals in a ReportFile object.
  - Make sure accesses to these globals are thread-safe.
  - Fix report_path functionality on Windows, where
    __sanitizer_set_report_path() would break program.

I've started this yak shaving in order to make
"CommonFlags::mmap_limit_mb" immutable. Currently we drop this flag
to zero before printing an error message.

Test Plan: regression test suite

Reviewers: kcc, glider

Subscribers: llvm-commits

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

llvm-svn: 224031
2014-12-11 18:30:25 +00:00
Viktor Kutuzov bf3d446528 [Tsan] Fix the signal_recursive.cc test to pass on systems with high loads
Differential Revision: http://reviews.llvm.org/D6504

llvm-svn: 224030
2014-12-11 17:42:29 +00:00
Dmitry Vyukov a1038b1081 tsan: fix Go build
GetRSS is used in Go build.

llvm-svn: 224023
2014-12-11 16:12:45 +00:00
Dmitry Vyukov 4bde5c42b0 tsan: don't subtract one from fake PCs
These are fake and not actual PCs, more like function IDs.
Pass them to external symbolizer untouched.

llvm-svn: 224022
2014-12-11 16:12:16 +00:00
Timur Iskhodzhanov 92292898ab Fix check-asan on Windows by putting lib/clang/... onto PATH (PR21880)
llvm-svn: 224018
2014-12-11 14:04:57 +00:00
Timur Iskhodzhanov 924a4921b4 Update ASan/Win test expectations broken by r223508
llvm-svn: 223932
2014-12-10 17:56:29 +00:00
Evgeniy Stepanov e14d29b1de [sanitizer] Disable compile-time checks for __kernel_old_uid_t size on aarch64.
Should fix PR21476.

llvm-svn: 223925
2014-12-10 11:44:09 +00:00
Saleem Abdulrasool 1fe0c18914 builtins: cleanup constant data section selection
Each of the object formats use a different directive for selecting the constant
section.  Use a macro to avoid the duplication across a number of files.  Also
correct a small macro mismatch on the Windows case (HIDDEN_DIRECTIVE -> HIDDEN).

Patch by Vadim Chugunov!

llvm-svn: 223910
2014-12-10 02:36:22 +00:00
Alexey Samsonov 20962292e8 [DD] Don't store the second copy of CommonFlags inside DDFlags.
llvm-svn: 223909
2014-12-10 02:30:04 +00:00
Alexey Samsonov c2485cab33 [CMake] Make sure dd is built as a part of compiler-rt.
Remove unused variables and definitions in CMake files
for TSan and DD (deadlock detector).

llvm-svn: 223908
2014-12-10 02:14:15 +00:00
Justin Bogner 55248db0c9 profile: Add low level versions of profile buffer functions
On Darwin, compiler_rt uses magic linker symbols to find the profile
counters in the __DATA segment.  This is a reasonable method for
normal, hosted, userspace programs.  However programs with custom
memory layouts, such as the kernel, will need to tell compiler_rt
explicitly where to find these sections.

Patch by Lawrence D'Anna. Thanks!

llvm-svn: 223840
2014-12-09 22:07:25 +00:00
Kostya Serebryany 83ed889bbd [tsan] remove TSAN_GO in favor of SANITIZER_GO
llvm-svn: 223732
2014-12-09 01:31:14 +00:00
Kostya Serebryany 6c54a6b5dd [asan] move GetRSS from tsan to sanitizer_common
llvm-svn: 223730
2014-12-09 01:22:59 +00:00
Alexey Samsonov 761e22ad8e Update bogus file permissions.
Suggested in http://reviews.llvm.org/D6547.

llvm-svn: 223715
2014-12-08 23:28:07 +00:00
Evgeniy Stepanov 3a9be641d5 [msan] Intercept wcsto*.
Intercept wcstod, wcstof, wcstold, wcstol, wcstoul, wcstoll, wcstoull.

llvm-svn: 223650
2014-12-08 10:41:28 +00:00
Kuba Brecka ddac6cbb34 XFAILing suppression tests on Android. The suppression files are not being transfered to the device.
llvm-svn: 223540
2014-12-05 22:47:44 +00:00
Kuba Brecka b79ccbeb71 Recommit of r223513 and r223514.
Reviewed at http://reviews.llvm.org/D6488

llvm-svn: 223533
2014-12-05 22:19:35 +00:00
Kuba Brecka cd9e81a363 Reverting r223513 and r223514.
llvm-svn: 223519
2014-12-05 21:32:22 +00:00
Peter Collingbourne fd860bc41a [DFSAN][MIPS] adding support of DFSAN for MIPS64
Minor changes to enable DFSAN on MIPS64

Patch by Kumar Sukhani!

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

llvm-svn: 223517
2014-12-05 21:22:36 +00:00
Kuba Brecka 423f3a0bc0 AddressSanitizer - Don't instrument globals from cstring_literals sections. (compiler-rt part)
Reviewed at http://reviews.llvm.org/D6488

llvm-svn: 223514
2014-12-05 21:05:04 +00:00
Kuba Brecka dde00302c7 Implement AddressSanitizer suppressions.
Adds 3 new suppression types, "interceptor_name", "interceptor_via_fun", "interceptor_via_lib".

Reviewed at http://reviews.llvm.org/D6280.

llvm-svn: 223508
2014-12-05 20:26:09 +00:00
Sergey Matveev eba518be94 [ASan] Refactor thread starting code.
Move thread context creation into AsanThread::Create().

llvm-svn: 223483
2014-12-05 17:31:13 +00:00
Sergey Matveev 5a03a9919f [LSan] Rewrite the test from r223419 to not use C++11.
This was causing build failures on llvm-clang-lld-x86_64-centos-6.5 for some
reason. Anyway, the new way is better because we no longer rely on std::thread
implementation details.

llvm-svn: 223480
2014-12-05 17:21:43 +00:00
Sergey Matveev 324ed20dcd [ASan] Fix Win build following r223419.
llvm-svn: 223477
2014-12-05 16:53:58 +00:00
Dmitry Vyukov 362d1202e2 tsan: fix test
this test is flaky because of ASLR
app memory is 7e8000000000-800000000000,
there may or may not be a 1TB hole depending on
where ASLR will choose to map libraries

llvm-svn: 223469
2014-12-05 15:42:17 +00:00
Dmitry Vyukov bf253a3d3f tsan: protect trace memory range on startup
so that user does not map something there ahead of us

llvm-svn: 223456
2014-12-05 10:06:06 +00:00
Sergey Matveev b029c5101f [ASan, LSan] Improve tracking of thread creation.
In the current scheme of things, the call to ThreadStart() in the child
thread is not synchronized with the parent thread. So, if a pointer is passed to
pthread_create, there may be a window of time during which this pointer will not
be discoverable by LSan. I.e. the pthread_create interceptor has already
returneed and thus the pointer is no longer on the parent stack, but we don't
yet know the location of the child stack. This has caused bogus leak reports
(see http://llvm.org/bugs/show_bug.cgi?id=21621/).

This patch makes the pthread_create interceptor wait until the child thread is
properly registered before returning.

llvm-svn: 223419
2014-12-05 00:10:15 +00:00
Hans Wennborg 217cf22cf6 CMake: build DLLs in the right directory and include them in the 'install' target (PR21719)
When CMake builds a dynamic library on Windows, the .dll file's location is
determined by the RUNTIME_OUTPUT_DIRECTORY, which we were previously not
setting.

This means for example that clang_rt.asan_dynamic-i386.dll will get built
and installed in the same directory as the corresponding .lib file,
instead of being built in the bin/ directory and not installed at all.

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

llvm-svn: 223387
2014-12-04 21:01:49 +00:00
Alexander Potapenko 5823daf73d [msan] Put the coverage files for coverage-levels.cc into a temporary dir.
llvm-svn: 223355
2014-12-04 11:35:32 +00:00
Kostya Serebryany 29a2236c7d [msan] allow -fsanitize-coverage=N together with -fsanitize=memory, compiler-rt part
llvm-svn: 223314
2014-12-03 23:29:14 +00:00
Hans Wennborg d59474a6cb ASan CMakeLists.txt: fix bad indent; NFC
llvm-svn: 223258
2014-12-03 19:05:42 +00:00
Evgeniy Stepanov 7395cae005 [msan] Change the way origin ids are built.
Previously, all origin ids were "chained" origins, i.e values of
ChainedOriginDepot. This added a level of indirection for simple
stack and heap allocation, which were represented as chains of
length 1. This costs both RAM and CPU, but provides a joined 2**29
origin id space. It also made function (any instrumented function)
entry non-async-signal-safe, but that does not really matter because
memory stores in track-origins=2 mode are not async-signal-safe anyway.

With this change, the type of the origin is encoded in origin id.
See comment in msan_origin.h for more details. This reduces chained and stack
origin id range to 2**28 each, but leaves extra 2**31 for heap origins.

This change should not have any user-visible effects.

llvm-svn: 223233
2014-12-03 13:58:40 +00:00
Evgeniy Stepanov fc77519c29 [asan] Fix stale_stack_leak.cc test in ASan-UAR mode.
This test does an intentional use-after-return, but this is not the focus of
the test, so ignore it.

llvm-svn: 223230
2014-12-03 13:35:41 +00:00
Evgeniy Stepanov 8a988c40c8 [msan] Add one more test for the handling of stack origins.
llvm-svn: 223229
2014-12-03 13:26:56 +00:00
Evgeniy Stepanov 340347a83f [msan] Re-enable one test.
It has been fixed a long time ago.

llvm-svn: 223226
2014-12-03 12:11:33 +00:00
Kostya Serebryany c93c84e882 [asan] fix four asan tests to run in use-after-return mode
llvm-svn: 223181
2014-12-03 00:08:41 +00:00
Alexey Samsonov 656c29b08f Replace InternalScopedBuffer<char> with InternalScopedString where applicable.
Summary: No functionality change.

Test Plan: make check-all

Reviewers: kcc

Reviewed By: kcc

Subscribers: llvm-commits

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

llvm-svn: 223164
2014-12-02 22:20:11 +00:00
Alexey Samsonov 3da2b06593 Add missing #include to fix Android build.
llvm-svn: 223157
2014-12-02 21:40:41 +00:00
Alexey Samsonov 0e90668f14 Simplify Symbolizer::SymbolizePC() interface.
Return a linked list of AddressInfo objects, instead of using an array of
these objects as an output parameter. This simplifies the code in callers
of this function (especially TSan).

Fix a few memory leaks from internal allocator, when the returned
AddressInfo objects were not properly cleared.

llvm-svn: 223145
2014-12-02 19:48:40 +00:00
Viktor Kutuzov 870e790924 [Tsan] Fix the atomic_race.cc test to pass on systems with high loads
Differential Revision: http://reviews.llvm.org/D6478

llvm-svn: 223122
2014-12-02 15:04:39 +00:00
Viktor Kutuzov fbd6ec09df [Tsan] Do not flush all streams on exit
Differential Revision: http://reviews.llvm.org/D6462

llvm-svn: 223121
2014-12-02 14:59:51 +00:00
Alexey Samsonov 4cdf4eba74 Add override specifiers to Symbolizer methods. NFC.
llvm-svn: 223094
2014-12-01 23:47:51 +00:00