Commit Graph

4483 Commits

Author SHA1 Message Date
Timur Iskhodzhanov 255958391d [ASan/Win] Print out a big warning and continue without checking for success if SymInitialize() fails
llvm-svn: 215203
2014-08-08 13:25:55 +00:00
Viktor Kutuzov 7a27160780 Support getting process maps for sanitizers needs on FreeBSD in 32-bit mode
Differential Revision: http://reviews.llvm.org/D4807

llvm-svn: 215185
2014-08-08 06:21:09 +00:00
Evgeniy Stepanov f5c1f8ac84 [sanitizer] Intercept timerfd_settime, timerfd_gettime.
llvm-svn: 215112
2014-08-07 14:21:42 +00:00
Evgeniy Stepanov 37e069c2ac [msan] Fix fcvt interceptor.
fcvt() result can be heap-allocated and must be unpoisoned.

llvm-svn: 215106
2014-08-07 12:45:55 +00:00
Viktor Kutuzov c68a37c531 Add FreeBSD support to the address sanitizer's malloc_context_size.cc test case
Differential Revision: http://reviews.llvm.org/D4665

llvm-svn: 215081
2014-08-07 04:58:41 +00:00
Alexey Samsonov 71b471fa09 [TSan] Try to fix Go runtime build
llvm-svn: 215000
2014-08-06 23:13:23 +00:00
Viktor Kutuzov a37ad099e8 Segregate FreeBSD-specific parts from sanitizer_procmaps_linux.cc
Differential Revision: http://reviews.llvm.org/D4555

llvm-svn: 214955
2014-08-06 10:16:52 +00:00
Dmitry Vyukov 70db9d4d72 tsan: allocate vector clocks using slab allocator
Vector clocks is the most actively allocated object in tsan runtime.
Current internal allocator is not scalable enough to handle allocation
of clocks in scalable way (too small caches). This changes transforms
clocks to 2-level array with 512-byte blocks. Since all blocks are of
the same size, it's possible to cache them more efficiently in per-thread caches.

llvm-svn: 214912
2014-08-05 18:45:02 +00:00
Timur Iskhodzhanov 0575694729 [ASan/Win] Handle SEH exceptions even with -GS
This is a follow-up to r213654, r213656, r213667 and r213668.

llvm-svn: 214861
2014-08-05 13:26:26 +00:00
Alexander Kornienko c3f7bcbd48 The test doesn't export ASAN_OPTIONS, so $ASAN_OPTIONS should not be used in RUN lines.
llvm-svn: 214855
2014-08-05 11:12:23 +00:00
Alexey Samsonov ff24fd2516 [UBSan] Allow to suppress reports from vptr checker for specified types.
Based on http://reviews.llvm.org/D4702 by Byoungyoung Lee!

llvm-svn: 214833
2014-08-05 01:24:22 +00:00
Alexey Samsonov ae1764854e [Sanitizer] Turn SuppressionContext::Init() into InitIfNecessary().
Suppression context might be used in multiple sanitizers working
simultaneously (e.g. LSan and UBSan) and not knowing about each other.

llvm-svn: 214831
2014-08-05 00:43:23 +00:00
Kostya Serebryany e9f24a9b3b [asan] poison array cookies only on 64-bit arch
llvm-svn: 214713
2014-08-04 12:59:45 +00:00
Kostya Serebryany 522c35eb80 [asan] introduce __asan_poison_cxx_array_cookie. This is asan-rt part of PR19838 (Left OOB accesses on new[]-allocated arrays with array cookies are not detected). No tests yet. They will follow once I commit the clang part.
llvm-svn: 214711
2014-08-04 12:43:13 +00:00
Kostya Serebryany 1cd57ebb6b [asan] intercept sized operator delete[]
llvm-svn: 214704
2014-08-04 10:10:50 +00:00
Alexey Samsonov d9ad5cec0c [ASan] Use metadata to pass source-level information from Clang to ASan.
Instead of creating global variables for source locations and global names,
just create metadata nodes and strings. They will be transformed into actual
globals in the instrumentation pass (if necessary). This approach is more
flexible:
1) we don't have to ensure that our custom globals survive all the optimizations
2) if globals are discarded for some reason, we will simply ignore metadata for them
   and won't have to erase corresponding globals
3) metadata for source locations can be reused for other purposes: e.g. we may
   attach source location metadata to alloca instructions and provide better descriptions
   for stack variables in ASan error reports.

No functionality change.

llvm-svn: 214604
2014-08-02 00:35:50 +00:00
Viktor Kutuzov f164bee0e0 Add FreeBSD support to the address sanitizer's deep_stack_uaf.cc test case
Differential Revision: http://reviews.llvm.org/D4668

llvm-svn: 214544
2014-08-01 19:37:05 +00:00
Viktor Kutuzov 62308221bc Fix the waitid sanitizer interceptor to work on FreeBSD in 32-bit mode
Differential Revision: http://reviews.llvm.org/D4670

llvm-svn: 214543
2014-08-01 19:33:14 +00:00
Ehsan Akhgari 9e5b6a08d4 [ASan] Support the asan_loadN/asan_storeN functions in the DLL thunk library
Summary:
This is required for linking DLLs with large functions exceeding
san-instrumentation-with-call-threshold.  One such function is
vp9_fdct16x16_sse2 in libvpx.

Reviewers: timurrrr

Subscribers: llvm-commits

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

llvm-svn: 214532
2014-08-01 18:04:53 +00:00
Alexey Samsonov 19fc293782 [Sanitizer] Don't try to parse unspecified suppressions file
llvm-svn: 214421
2014-07-31 19:06:47 +00:00
Evgeniy Stepanov 1cd9e019da [asan] End-to-end test for REP MOVS instrumentation.
Patch by Yuri Gorshenin.

llvm-svn: 214396
2014-07-31 09:12:20 +00:00
Dmitry Vyukov b7e8e5cdc0 tsan: use MADV_NOHUGEPAGE only if it is supported by platform
Fixes build failure on an old system:
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-centos-6.5/builds/7555/steps/build/logs/stdio

llvm-svn: 214394
2014-07-31 08:24:59 +00:00
Alexey Samsonov 89b17bb7bc [Sanitizer] Hoist the code parsing suppressions file into sanitizer_common.
Remove corresponding bits from LSan and TSan runtimes. No functionality change.

llvm-svn: 214344
2014-07-30 21:53:30 +00:00
Alexey Samsonov 77f646c623 [Sanitizer] Make "suppressions" and "print_suppressions" common runtime flags.
No functionality change.

llvm-svn: 214343
2014-07-30 21:33:04 +00:00
Alexey Samsonov 34a4c6e12f [Sanitizer] Make SuppressionContext a singleton class, residing in sanitizer_common.
Convert TSan and LSan to the new interface. More changes will follow:
1) "suppressions" should become a common runtime flag.
2) Code for parsing suppressions file should be moved to SuppressionContext::Init().

llvm-svn: 214334
2014-07-30 20:54:37 +00:00
Evgeniy Stepanov c3478490ed [asan] XFAIL sized-delete test on Android.
llvm-svn: 214303
2014-07-30 12:39:30 +00:00
Kostya Serebryany e7532e59c0 [asan] rename new-delete-size-mismatch to new-delete-type-mismatch and make the report more verbose
llvm-svn: 214299
2014-07-30 11:20:37 +00:00
Kostya Serebryany 69852a843c [asan] add a feature to detect new-delete-size-mismatch (when used with -Xclang -fsized-deallocation). Not yet on Mac. Also, remove some unused code.
llvm-svn: 214296
2014-07-30 09:48:23 +00:00
Evgeniy Stepanov 5c72938c39 [msan] Use SIGHUP instead of SIGUSR1 in test.
Apparently, SIGUSR1 does not work on x86_64+ArchLinux for some reason.

For more details, see:
https://groups.google.com/forum/#!topic/llvm-dev/4Ag1FF4M2Dw

llvm-svn: 214289
2014-07-30 08:17:58 +00:00
Alexey Samsonov 96591cd1f1 [UBSan] Introduce ScopedReport object.
This object is used to encapsulate all actions that need to be
done before/after printing UBSan diagnostics. Currently these
actions are:
* locking a mutex to ensure that UBSan diagnostics from several
threads won't mix with each other and with other sanitizers' 
reports
* killing a program once the report is printed (if necessary).

Use this object in all UBSan handlers. Unify the way we implement
fatal and non-fatal handlers by making all the handlers simple
one-liners that redirect __ubsan_handle_foo(_abort)? to
handleFooImpl().

llvm-svn: 214279
2014-07-30 01:49:19 +00:00
Alexey Samsonov 64a5f0fa1a [UBSan] Allow to override runtime flags defaults by providing
compile definition UBSAN_DEFAULT_OPTIONS when building the runtime.
This mirrors similar ASan functionality.

llvm-svn: 214259
2014-07-30 00:01:41 +00:00
Alexey Samsonov 6ae5bac794 [UBSan] Move all runtime flags parsing to ubsan_flags.cc.
No functionality change.

llvm-svn: 214258
2014-07-29 23:49:20 +00:00
Alexey Samsonov 20c5c7b723 [UBSan] Get pc/bp for stack unwinding as early as possible.
This will ensure that stack frames in error reports will not
contain internal UBSan failures, and frame #0 will be the
actual place in the program where the error happens.

llvm-svn: 214245
2014-07-29 23:22:41 +00:00
Alexey Samsonov 17edc9230e [UBSan] Build part of UBSan runtime that can be linked into C programs with -fno-rtti flag.
llvm-svn: 214232
2014-07-29 21:52:25 +00:00
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