Commit Graph

3909 Commits

Author SHA1 Message Date
Joerg Sonnenberger 9720fcf4bf Redo THUMB support.
Discussed with and tested by: Saleem Abdulrasool

llvm-svn: 213481
2014-07-20 20:53:37 +00:00
Joerg Sonnenberger 8f6cf7085a Revert r213467, it breaks non-thumb mode.
llvm-svn: 213479
2014-07-20 20:00:26 +00:00
Saleem Abdulrasool 8817bfe7e2 ARM: fix division in some cases
For ARM cores that are ARMv6T2+ but not ARMv7ve or ARMv7-r and not an updated
ARMv7-a that has the idiv extension (chips with clz but not idiv), an incorrect
jump would be calculated due to the preference to thumb instructions over ARM.

Rather than computing the target at runtime, use a jumptable instead.  This
trades a bit of storage for performance.  The overhead is 32-bytes for each of
the three routines, but avoid the calculation of the offset.

Because clz was introduced in ARMv6T2 and idiv in certain versions of ARMv7,
the non-clz, non-idiv case implies a target which does not support Thumb-2, and
thus we cannot use Thumb on those targets (as it is unlikely that the assembly
will assemble).

Take the opportunity to refactor the IT block macros into assembly.h rather than
redefining them in the TUs where they are used.

Existing tests cover the full change already, so no new tests are added.

This effectively reverts SVN r213309.

llvm-svn: 213467
2014-07-20 04:44:21 +00:00
Dmitry Vyukov 9cf7ac7589 tsan: fix Go runtime build with clang
llvm-svn: 213384
2014-07-18 15:32:22 +00:00
Dmitry Vyukov a8df247f5a tsan: expose atomic operations in Go runtime
llvm-svn: 213382
2014-07-18 14:54:02 +00:00
Viktor Kutuzov 5f5adb8ed5 Add FreeBSD support to the Asan symbolization script
Differential Revision: http://reviews.llvm.org/D4560

llvm-svn: 213370
2014-07-18 12:07:00 +00:00
Stephen Hines 31a38cc32f Revert Thumb-2 conversion of some ARM builtins.
The udivmodsi4/modsi3/umodsi3 code computes jump targets based on ARM encodings
(if CLZ is present and IDIV is not present).

Reverts parts of r211032 and r211035.

llvm-svn: 213309
2014-07-17 20:41:01 +00:00
Evgeniy Stepanov 92d20f3f90 [asan] Remove leftover debug printf.
llvm-svn: 213264
2014-07-17 13:05:21 +00:00
Evgeniy Stepanov f62cd5559e [asan] Fix malloc interception on Android L Preview.
Format of __libc_malloc_dispatch has changed in Android L.
While we are moving towards a solution that does not depend on bionic
internals, here is something to support both K* and L releases.

llvm-svn: 213263
2014-07-17 12:48:45 +00:00
Kuba Brecka 033890cd0a [compiler-rt] [asan] Refactor DescribeAddressIfStack to allow reuse for debugging API
Refactoring the DescribeAddressIfStack function in asan_report.cc to be able to reuse it for http://reviews.llvm.org/D4527.

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

llvm-svn: 213215
2014-07-17 00:18:03 +00:00
Timur Iskhodzhanov bdf23a51b1 [ASan/Win] Handle situations when the client app has used DbgHelp before
Reviewed at http://reviews.llvm.org/D4533

llvm-svn: 213151
2014-07-16 14:11:02 +00:00
Alexander Potapenko 9c62a6d8a2 [ASan] Factor out SymbolizationLoop.process_line() function to let Python
scripts that import asan_symbolize to symbolize their reports line by line.

llvm-svn: 213136
2014-07-16 11:00:16 +00:00
Kuba Brecka 58f44dce96 [ASan] Add ASan debugging API to get malloc/free stack traces and shadow memory mapping info
Reviewed at http://reviews.llvm.org/D4466

llvm-svn: 213080
2014-07-15 17:33:23 +00:00
Dmitry Vyukov 1015f8d753 tsan: remove special handling of false reports coming from JVM
There is now a more common functionality in the form of called_from_lib suppressions.

llvm-svn: 213057
2014-07-15 09:38:30 +00:00
Dmitry Vyukov 48b00fe8f9 tsan: remove compat mapping
There are no known usages anymore, so one less thing to support.

llvm-svn: 213056
2014-07-15 09:31:29 +00:00
Timur Iskhodzhanov 9e4580c8ee [ASan] Only define macros in asan_init_version.h, move the __asan_init declaration back to asan_interface_internal.h
This fixes the issues we've uncovered after landing r212815.

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

llvm-svn: 213053
2014-07-15 08:16:04 +00:00
Ehsan Akhgari 911ea4e2be Add support for intercepting thunks of the form
llvm-svn: 212979
2014-07-14 20:28:21 +00:00
Evgeniy Stepanov d73e7cc879 [sanitizer] Intercept getpass.
llvm-svn: 212937
2014-07-14 13:07:51 +00:00
Evgeniy Stepanov 465466e80c [msan] Stop demangling function name in the stack origin report.
This was done by calling __cxa_demangle directly, which is bad
when c++abi library is instrumented. The following line always
contains the demangled name (when running with a symbolizer) anyway.

llvm-svn: 212929
2014-07-14 09:35:27 +00:00
Alexey Samsonov ae9d59e8c4 [ASan] Improve ODR-violation error reports.
Demangle names of involved globals. Print a more consistent summary line.

llvm-svn: 212857
2014-07-11 23:34:26 +00:00
Kostya Serebryany 8e9a5b1899 [asan] fix x32 build, patch by H.J. Lu
llvm-svn: 212823
2014-07-11 15:22:45 +00:00
Timur Iskhodzhanov 03f1e408de [ASan/Win] Don't apply dllexport to __asan_init in the DLL thunk
This fixes '___asan_init_v4 already defined' errors when linking some of Chromium DLLs.
Looks like one of the DLL is using a .lib produced while linking another DLL and it exploded after r212699.
I'm trying to come up with a small testcase...

llvm-svn: 212815
2014-07-11 13:46:05 +00:00
Timur Iskhodzhanov f6827cef73 [ASan] Print register values in a consistent way
llvm-svn: 212809
2014-07-11 12:14:46 +00:00
Timur Iskhodzhanov 19853dd28c [ASan/Win] Catch NULL derefs and page faults
Reviewed at http://reviews.llvm.org/D4471

llvm-svn: 212807
2014-07-11 11:57:41 +00:00
Evgeniy Stepanov 9c62621c4b [msan] A comment for the chained-origin-depot hash function.
llvm-svn: 212801
2014-07-11 09:09:37 +00:00
Evgeniy Stepanov db298121e0 [msan] Use real memset/memcpy/memmove in interceptors.
Our versions are not exactly as fast as libc's, and
MSan uses them heavily (even compared to other sanitizers).

This will break if libc version of mem* are instrumented,
but they never are, and if they are, we should be able
to fix it on libc side.

llvm-svn: 212799
2014-07-11 08:57:57 +00:00
Alexey Samsonov 3a2cb3ad41 [TSan] Fix a bug in libcxx-tsan build conditions spotted by Ryuta Suzuki
llvm-svn: 212749
2014-07-10 18:17:51 +00:00
Evgeniy Stepanov 8fc7e1fb13 [msan] Fix performance issue in fast_memset.
Fast path was never triggered when called from __msan_poison.

llvm-svn: 212715
2014-07-10 12:45:56 +00:00
Evgeniy Stepanov c2c435f95d [msan] Switch chained origins hash to murmur2.
llvm-svn: 212704
2014-07-10 11:02:33 +00:00
Timur Iskhodzhanov 3eb1f4bb90 [ASan/Win] Don't hardcode ASan runtime version in ASan dll thunk
Reviewed at http://reviews.llvm.org/D4459

llvm-svn: 212699
2014-07-10 10:33:48 +00:00
Tim Northover 9775cffe14 MachO: add dummy armv6m architecture directory so clang_macho_embedded builds things.
Without some mention of armv6m in a subdirectory of builtins, the make code
doesn't even know that armv6m exists and is something it should be looking for
in the platform-specific Makefiles. This means that none of the functions
listed actually get built and we end up with an almost entirely empty
libclang_rt.a for armv6m.

Unfortunately, the assembly code in the usual arm directory has no hope of
running on armv6m, which only supports Thumb-1 (not even ARM mode), so adding
it there won't work. Realistically, we probably *will* want to put any
optimised versions in a separate directory, so creating it now is harmless.

rdar://problem/17613576

llvm-svn: 212696
2014-07-10 10:06:42 +00:00
Viktor Kutuzov f294f25d3a Make sanitizers' interceptors non-weak on FreeBSD
Differential Revision: http://reviews.llvm.org/D4418

llvm-svn: 212693
2014-07-10 09:16:58 +00:00
Viktor Kutuzov 794d4dde48 Only use fast stack unwinding for sanitizers failure reports on FreeBSD
Differential Revision: http://reviews.llvm.org/D4420

llvm-svn: 212691
2014-07-10 09:11:15 +00:00
Viktor Kutuzov d0907ae222 Fix getting environment variables for sanitizers needs on FreeBSD
Differential Revision: http://reviews.llvm.org/D4229

llvm-svn: 212690
2014-07-10 08:53:29 +00:00
Alexey Samsonov 020ac94665 [ASan] Force the compiler to generate frame pointer in certain Mac-specific interceptors.
Patch by Kuba Brecka!

llvm-svn: 212664
2014-07-10 00:06:53 +00:00
Alexey Samsonov f723794da8 [Sanitizer] Remove SANITIZER_NEEDS_SEGV from shared sanitizer_common headers.
Otherwise, it can be accidentally redefined when we build specific sanitizer
runtime. This definition should be provided only once - when we build
sanitizer_common library.

llvm-svn: 212663
2014-07-09 23:59:40 +00:00
Alexey Samsonov cd0a4aaba3 Don't check lint for SpecialCaseList.cpp
llvm-svn: 212642
2014-07-09 19:29:10 +00:00
Dmitry Vyukov 67ccf9851c tsan: reapply 212531 and 212532 with a fix
don't reset s->addr as well

llvm-svn: 212565
2014-07-08 20:37:16 +00:00
Alexey Samsonov 047ea1717b [TSan] Revert r212531 and r212532.
They cause "check-tsan" command to hang. Details in r212532 review thread.

llvm-svn: 212562
2014-07-08 20:17:19 +00:00
Dmitry Vyukov 3f5ad1a98e tsan: allow memory overlap in __tsan_java_move
JVM actually moves memory between overlapping ranges.

llvm-svn: 212560
2014-07-08 20:01:12 +00:00
Evgeniy Stepanov eb893a1fd6 [msan] Fix out of bounds access in origin copying.
llvm-svn: 212534
2014-07-08 14:15:23 +00:00
Kostya Serebryany 6136aae323 [tsan] Enable tsan's deadlock detector by default.
The tsan's deadlock detector has been used in Chromium for a while;
it found a few real bugs and reported no false positives.
So, it's time to give it a bit more exposure.

llvm-svn: 212533
2014-07-08 13:40:08 +00:00
Dmitry Vyukov edbb54d60c tsan: fix a potential hang
idx0 is not updated in the branch,
so if we take that branch idx0 will stay updated forever

llvm-svn: 212532
2014-07-08 13:36:59 +00:00
Dmitry Vyukov a480d3013a tsan: fix a bug in metamap
The bug happens in the following case:
Mutex is located at heap block beginning,
when we call MutexDestroy, s->next is set to 0,
so free can't find the MBlock related to the block.

llvm-svn: 212531
2014-07-08 13:28:01 +00:00
Kostya Serebryany 3d570b960e [tsan] fix deadlock detector's interoperation with java locks (https://code.google.com/p/thread-sanitizer/issues/detail?id=67)
llvm-svn: 212529
2014-07-08 13:16:03 +00:00
Dmitry Vyukov b0250948c6 tsan: remove unnecessary line split
llvm-svn: 212527
2014-07-08 13:07:23 +00:00
Kostya Serebryany 7e49b06446 [tsan] fix pthread_rwlock_tryrdlock interceptor, don't try to detect deadlocks when reporting bad unlock
llvm-svn: 212526
2014-07-08 12:46:30 +00:00
Viktor Kutuzov cc02abbb20 Support building floating-point facilities on FreeBSD 9.2 in 32-bit mode
Differential Revision: http://reviews.llvm.org/D3909

llvm-svn: 212518
2014-07-08 08:52:57 +00:00
Alexey Samsonov 58a046fe56 [ASan] Clean up leftovers from assembly instrumentation helpers
llvm-svn: 212471
2014-07-07 18:11:24 +00:00
Alexey Samsonov 91bb8e0e3a Generalize sanitizer allocator public interface.
Introduce new public header <sanitizer/allocator_interface.h> and a set
of functions __sanitizer_get_ownership(), __sanitizer_malloc_hook() etc.
that will eventually replace their tool-specific equivalents
(__asan_get_ownership(), __msan_get_ownership() etc.). Tool-specific
functions are now deprecated and implemented as stubs redirecting
to __sanitizer_ versions (which are implemented differently in each tool).

Replace all uses of __xsan_ versions with __sanitizer_ versions in unit
and lit tests.

llvm-svn: 212469
2014-07-07 17:39:31 +00:00