Commit Graph

4449 Commits

Author SHA1 Message Date
Alexey Samsonov 8b9d18e4fe [UBSan] Try to enable pipefail in UBSan lit tests to make them behave more predictably
llvm-svn: 214149
2014-07-29 00:30:01 +00:00
Alexey Samsonov 4462ec6c02 Exclude ASM from CompilerRT languages as an attempt to fix CMake failure in standalone mode
llvm-svn: 214130
2014-07-28 22:04:19 +00:00
Dmitry Vyukov 3baf5b390d tsan: add a useful debug check
llvm-svn: 214082
2014-07-28 13:54:18 +00:00
Saleem Abdulrasool 3a2d6a3096 builtins: make ARM compilation with GAS work again
The LLVM IAS seems to accept wide instructions for add and sub in ARM mode even
though it is not permitted.  This uses a macro to ensure that the wide modifier
is only applied when building in THUMB mode.

This repairs building with GCC/GAS in ARM mode.

llvm-svn: 214046
2014-07-27 02:01:24 +00:00
Saleem Abdulrasool b6690c34cf builtins: move macro definitions into assembly.h
The macro definitions are shared across multiple files.  Define them once in the
assembly.h header rather than redefining it in each file.

llvm-svn: 214045
2014-07-27 02:01:20 +00:00
Saleem Abdulrasool 31306b1571 builtins: whitespace
llvm-svn: 214044
2014-07-27 02:01:15 +00:00
Saleem Abdulrasool b72a2fdd72 builtins: avoid multiple definitions of symbols
The architecture specific implementation of routines would be built and included
along with the generic implementation.  This would result in multiple
definitions of those symbols.

The linker is free to select either of the two.  Most of the time, this
shouldn't be too terrible as the forward iteration should catch the architecture
version due to the ordering.  Rather than relying on the linker and build
infrastructure ordering things in a specific manner, only provide the
architecture version when available.

This reduces the size of compiler-rt, simplifies inspection of the library
implementations, and guarantees that the desired version is selected at a
slightly complex build system.

llvm-svn: 214040
2014-07-26 23:44:22 +00:00
Saleem Abdulrasool 24c68b26d8 builtins: add missed files from previous commits
This adds missed files in SVN r214033 for alignment and corrects a change from
SVN r214034 for fixing compilation with GCC.

llvm-svn: 214039
2014-07-26 23:44:18 +00:00
Saleem Abdulrasool 12ae9a8704 builtins: move the readonly constants into rodata
Place the floating point constants into the read-only data section.  This was
already being done for x86_64, this simply mirrors the behaviour for i686.

llvm-svn: 214034
2014-07-26 21:08:41 +00:00
Saleem Abdulrasool 15a906cf37 builtins: correct constant alignments
MMX/SSE instructions expect 128-bit alignment (16-byte) for constants that they
reference.  Correct the alignment on the constant values.  Although it is quite
possible for the data to end up aligned, there is no guarantee that this will
occur unless it is explicitly aligned to the desired location.  If the data ends
up being unaligned, the resultant binary would fault at runtime due to the
unaligned access.

As an example, the follow would fault previously:
  cc -c lib/builtins/x86_64/floatundidf.S -o floatundidf.o
  cc -c test/builtins/Unit/floatundidf_test.c -o floatundidf_test.c
  ld -m elf_x86_64 floatundidf.o floatundidf_test.o -lc -o floatundidf

However, if the object files were reversed, the data would end up aligned and
the problem would go unnoticed.

llvm-svn: 214033
2014-07-26 21:08:34 +00:00
Dmitry Vyukov 7b70cadae9 tsan: advise shadow for 0x7f region to not use huge pages
see the comment for justification

llvm-svn: 214030
2014-07-26 17:41:10 +00:00
Dmitry Vyukov 5b1b02eb29 tsan: improve shadow flush benchmark
allow to specify access stride

llvm-svn: 214029
2014-07-26 16:40:33 +00:00
Dmitry Vyukov 4baa65518b tsan: reduce internal allocator region from 16M to 1M
16M regions can waste almost 1G for nothing.
Since region size is used only during initial heap growth,
it's unclear why we even need such huge regions.

llvm-svn: 214027
2014-07-26 10:17:26 +00:00
Dmitry Vyukov 07fdaf97e4 tsan: remove meta from internal allocator
I am puzzled why it is even there.

llvm-svn: 214026
2014-07-26 10:06:11 +00:00
Nick Lewycky 1f30f5aef7 Satisfy -Wparentheses.
llvm-svn: 214017
2014-07-26 05:07:41 +00:00
Saleem Abdulrasool 7618240aa9 builtins: re-enable building assembly sources
Re-apply SVN r213684 which was reverted in SVN r213724 since it broke the
build bots.  Add a tweak to enable inclusion of the assembly sources in
standalone build as well.

Original commit message:

This patch address the PR20360. The CMake assembler build system
ignores the .S assembly files in builtins library build. This patch
fixes the issue.

llvm-svn: 214013
2014-07-26 04:04:02 +00:00
Saleem Abdulrasool 93efc78a04 builtins: make the x86_64 compatible with GAS
The .rodata directive was added on the IA-64 (Itanium) platform.  The LLVM IAS
supports the .rodata on i386 and x86_64 as well.  There is no reason to really
restrict compilation of the builtins to just clang.  By explicitly indicating
that the data is meant to be pushed into the .rodata section via the .section
.rodata, the assembly is made compatible with clang and gcc (with GAS).

This will enable building these routines on the Linux buildbots via CMake.

llvm-svn: 214012
2014-07-26 04:03:59 +00:00
Alexey Samsonov e87e5ce5d6 [UBSan] Initialize symbolizer inside __ubsan::Init().
We used to initialize symbolizer lazily, but this doesn't work in
various sandboxed environments. Instead, let's be consistent with
the rest of sanitizers.

llvm-svn: 214006
2014-07-26 01:41:45 +00:00
Alexey Samsonov 1440105338 [Sanitizer] Simplify Symbolizer creation interface.
Get rid of Symbolizer::Init(path_to_external) in favor of
thread-safe Symbolizer::GetOrInit(), and use the latter version
everywhere. Implicitly depend on the value of external_symbolizer_path
runtime flag instead of passing it around manually.

No functionality change.

llvm-svn: 214005
2014-07-26 01:37:23 +00:00
Alexey Samsonov f51b9488c6 [DFSan] Fixup for r213980
llvm-svn: 213997
2014-07-26 00:49:36 +00:00
Alexey Samsonov 6eb53d6460 [UBSan] Call UBSan initialization as early as possible.
Specifically, use .preinit_array initialization on Linux and dynamic global
initializer on another platforms. Historically UBSan didn't have any
initialization code and its runtime was stateless. This is no longer the
case - UBSan relies on some non-trivial functionality from sanitizer_common
(e.g. online symbolization) and is now configurable by runtime flags.
Additionally, we've dropped support for enabling UBSan only for a few shared
objects, so UBSan is now always linked into the main executable, so now
we can use similar initialization as all the rest sanitizers.

llvm-svn: 213983
2014-07-25 22:24:34 +00:00
Alexey Samsonov 2178054216 [Sanitizer] Introduce SANITIZER_CAN_USE_PREINIT_ARRAY definition and use it across sanitizers.
Get rid of ASAN_USE_PREINIT_ARRAY and LSAN_USE_PREINIT_ARRAY - just always
use .preinit_array if it's available. This mode seems stable enough, and
we've been relying on default values of these macro for a long time.

llvm-svn: 213980
2014-07-25 22:05:02 +00:00
Dmitry Vyukov 6819cf4974 tsan: query RSS every 100ms
Now that it become faster, it's OK to query it every 100ms again.

llvm-svn: 213943
2014-07-25 13:48:25 +00:00
Dmitry Vyukov fe17080c88 tsan: fix and make faster GetRSS
It is currently broken because it reads a wrong value from profile (heap instead of total).
Also make it faster by reading /proc/self/statm. Reading of /proc/self/smaps
can consume more than 50% of time on beefy apps if done every 100ms.

llvm-svn: 213942
2014-07-25 13:47:57 +00:00
Viktor Kutuzov d712403b98 Allow initialization of Asan interceptors before the general Asan initialization takes place on FreeBSD
Differential Revision: http://reviews.llvm.org/D4496

llvm-svn: 213941
2014-07-25 12:45:36 +00:00
Viktor Kutuzov 2fde54f48c Support traversing ELF objects for sanitizers needs on FreeBSD in 32-bit mode
Differential Revision: http://reviews.llvm.org/D4656

llvm-svn: 213940
2014-07-25 12:29:04 +00:00
Alexander Potapenko 08cfa79d87 [lsan] Follow-up for r213518: replace MAP_ANONYMOUS with MAP_ANON
(despite it's deprecated on Linux) to remove the ifdefs.

llvm-svn: 213929
2014-07-25 08:57:51 +00:00
Viktor Kutuzov 545ff90d47 Add FreeBSD support to Asan test cases that use mmap() with MAP_ANON
Differential Revision: http://reviews.llvm.org/D4561

llvm-svn: 213858
2014-07-24 12:05:13 +00:00
Alexey Samsonov 16ea3268b2 Build libcxx-tsan only if TSan is supported on host architecture
llvm-svn: 213791
2014-07-23 20:07:26 +00:00
Alexey Samsonov db615d565d Fix unused-variable warning
llvm-svn: 213786
2014-07-23 19:40:54 +00:00
Alexey Samsonov bfa711c8b0 [UBSan] Add the ability to dump call stacks to -fsanitize=vptr
This change introduces the first UBSan-specific runtime flag: print_stacktrace
(off by default). It can be set in UBSAN_OPTIONS to unwind and print call stacks
in addition to diagnostic messages. For now these stacks are printed only
in vptr checker.

This change is based on http://reviews.llvm.org/D4410 by Byoungyoung Lee!

llvm-svn: 213783
2014-07-23 18:44:54 +00:00
Alexey Samsonov cd875aa551 [UBSan] Introduce UBSAN_OPTIONS environment variable.
If UBSan is run in a standalone mode (w/o any other sanitizer), it
still uses functions from sanitizer_common, some of which depend on
the value of runtime flags. Allow to override the default values of these
flags with UBSAN_OPTIONS variable. In particular, UBSAN_OPTIONS=symbolize=0
can be used to turn off online symbolization.

llvm-svn: 213782
2014-07-23 18:32:55 +00:00
Renato Golin bb3d7b5e81 Revert "Include assembly files in builtins library build"
This reverts commit r213684, since it was breaking the compiler-rt
build and the sanitizers' bot.

llvm-svn: 213724
2014-07-23 04:46:23 +00:00
Alexey Samsonov ad63cfd7e5 [Sanitizer] Disable Wframe-larger-than on PowerPC hosts
llvm-svn: 213702
2014-07-22 23:10:13 +00:00
Renato Golin 8c714213d5 Fix incompatible assembly in ARM builtins library
Convert the CBNZ backward branch instruction to CMP and BNE
avoiding illegal backwards branch and making the assembly code
in synh-ops.h to be UAL compliant.

Patch by: Sumanth Gundapaneni

llvm-svn: 213685
2014-07-22 20:59:41 +00:00
Renato Golin aad0347c8b Include assembly files in builtins library build
The CMake assembler build system ignores the .S assembly files in builtins
library build. This patch fixes the issue.

Patch by: Sumanth Gundapaneni

llvm-svn: 213684
2014-07-22 20:59:38 +00:00
Timur Iskhodzhanov 4bea5a83bd [ASan/Win tests] Bring back -GS- as SEH tests fail otherwise
llvm-svn: 213668
2014-07-22 16:09:11 +00:00
Timur Iskhodzhanov 74487a7c32 [ASan/Win tests] Don't generate debug info where it is not needed
Otherwise it results in flaky tests

llvm-svn: 213667
2014-07-22 15:53:10 +00:00
Timur Iskhodzhanov cb5bf58f3d [ASan/Win] Add SEH handling to the DLL thunk as well
llvm-svn: 213656
2014-07-22 14:02:53 +00:00
Timur Iskhodzhanov 6d4a6cd68f [ASan/Win] Handle SEH exceptions (best-effort, similar to longjmp)
llvm-svn: 213654
2014-07-22 13:44:18 +00:00
Timur Iskhodzhanov f2b96e3009 [ASan/Win] Add handling of C++ exceptions to the RTL
Also add a longjmp() test

llvm-svn: 213649
2014-07-22 12:37:51 +00:00
Timur Iskhodzhanov 8f41c3eb74 [ASan] Simplify exception/longjmp tests even further
llvm-svn: 213646
2014-07-22 12:25:51 +00:00
Timur Iskhodzhanov 723c81ff80 [ASan] Split throw_catch tests into two files: throw/catch + longjmp
Also add some more assertions into these tests

llvm-svn: 213642
2014-07-22 11:46:24 +00:00
Alexey Samsonov d6906e4ffe [MSan] Fix strncpy interceptor
llvm-svn: 213590
2014-07-22 00:10:08 +00:00
Alexey Samsonov a89ad664b1 [ASan] Fix __asan_describe_address and add a test for it.
llvm-svn: 213583
2014-07-21 21:33:46 +00:00
Alexey Samsonov 4532489752 Adjust gen_dynamic_list for PowerPC function descriptors
llvm-svn: 213577
2014-07-21 19:01:03 +00:00
Alexander Potapenko 96008ea849 [lsan] Allow using ucontext.h in the test on OSX.
llvm-svn: 213523
2014-07-21 13:35:09 +00:00
Alexander Potapenko e816521c00 [lsan] Define MAP_ANONYMOUS as MAP_ANON for OSX in the test.
llvm-svn: 213518
2014-07-21 13:12:44 +00:00
Alexander Potapenko 4789f63bf3 [lsan] Use a more standard-conformant sched_yield() instead of pthread_yield().
There's no pthread_yield() on OSX (only sched_yield() and pthread_yield_np()).

llvm-svn: 213516
2014-07-21 13:01:06 +00:00
Joerg Sonnenberger 9720fcf4bf Redo THUMB support.
Discussed with and tested by: Saleem Abdulrasool

llvm-svn: 213481
2014-07-20 20:53:37 +00:00