Commit Graph

5440 Commits

Author SHA1 Message Date
Evgeniy Stepanov e2a8241f84 [sancov] Shrink pc array on Android back to 2**24.
Address space is a lot more constrained on 32-bit Android compared to Linux.

llvm-svn: 234010
2015-04-03 12:59:39 +00:00
Timur Iskhodzhanov ad3ec82bb1 [ASan/Win] Minor improvements towards enabling coverage
llvm-svn: 233918
2015-04-02 14:48:08 +00:00
Alexey Samsonov d4273ebbf3 Add missing " at the end of the #error directive.
llvm-svn: 233879
2015-04-02 01:13:43 +00:00
Peter Collingbourne 7881648a4e Add tests for non-virtual call checking.
Differential Revision: http://reviews.llvm.org/D8792

llvm-svn: 233876
2015-04-02 00:33:36 +00:00
Alexey Samsonov 9c2116d912 [CMake] Fixup for r233861: don't build standalone UBSan on unsupported platforms.
llvm-svn: 233865
2015-04-01 23:00:02 +00:00
Alexey Samsonov 09dce3b7e5 [UBSan] Embed UBSan into ASan runtime (compiler-rt part).
Summary:
Change the way we use ASan and UBSan together. Instead of keeping two
separate runtimes (libclang_rt.asan and libclang_rt.ubsan), embed UBSan
into ASan and get rid of libclang_rt.ubsan. If UBSan is not supported on
a platform, all UBSan sources are just compiled into dummy empty object
files. UBSan initialization code (e.g. flag parsing) is directly called
from ASan initialization, so we are able to enforce correct
initialization order.

This mirrors the approach we already use for ASan+LSan. This change
doesn't modify the way we use standalone UBSan.

Test Plan: regression test suite

Reviewers: kubabrecka, zaks.anna, rsmith, kcc

Subscribers: llvm-commits

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

llvm-svn: 233861
2015-04-01 22:42:36 +00:00
Alexander Potapenko 0ae78444e7 [ASan] Make the remaining coverage tests pass on Darwin, move them to Posix/
This CL:
 - moves PrepareForSandboxing() to sanitizer_posix_libcdep.cc
 - fixes the coverage tests to use flag substitutions defined in r233802 and not rely on hardcoded shared library names
 - moves those tests to TestCases/Posix so that they can be executed on Darwin

llvm-svn: 233828
2015-04-01 17:56:29 +00:00
Bill Seurer f1b82e3ad1 Remove XFAILs from cast-overflow.cpp
My fix for power also fixed armv7l-unknown-linux-gnueabihf and aarch64

llvm-svn: 233827
2015-04-01 17:50:39 +00:00
Alexander Potapenko 9be2c6544b [ASan] Speculative fix for TestCases/Posix/interception-in-shared-lib-test.cc and TestCases/suppressions-library.cc on FreeBSD.
r233802 has moved the tests above to Posix/ and introduced %ld_flags_rpath_so and %ld_flags_rpath_exe,
which haven't been defined for FreeBSD.
We expect the flags to be the same on Linux and FreeBSD. If there's another reason for the tests to fail on FreeBSD,
they'll need to be disabled.

llvm-svn: 233822
2015-04-01 17:07:50 +00:00
Bill Seurer 4c41366510 [PPC64]This activates UBSan for the power architecture.
One test case is updated to allow for differences between power and other architectures in behavior when returning from main in certain instances

http://reviews.llvm.org/D8743

llvm-svn: 233813
2015-04-01 15:33:22 +00:00
Timur Iskhodzhanov 882bc56ff1 [Sanitizers Coverage] Make sancov.py work with wildcards from Windows CMD shell
Reviewed at http://reviews.llvm.org/D8724

llvm-svn: 233809
2015-04-01 14:46:10 +00:00
Alexander Potapenko 8db9e77ba7 [ASan] Deduplicate interception-in-shared-lib-test.cc by introducing platform-specific substitutions for rpath linker flags
Also make suppressions-library.cc use the same flags to avoid warnings about unused -rpath flags.
The same substitutions will be used to make coverage tests work on both Linux and Darwin without duplicating the code.

llvm-svn: 233802
2015-04-01 12:13:03 +00:00
Alexey Samsonov c4ed548b40 [Sanitizer] Be consistent about separating ==%PID== and logged data.
See https://code.google.com/p/address-sanitizer/issues/detail?id=385.

llvm-svn: 233720
2015-03-31 18:16:42 +00:00
Timur Iskhodzhanov 89608af26d [ASan/Win] UnmapOrDie should not fail on zero address / size
llvm-svn: 233707
2015-03-31 16:39:20 +00:00
Timur Iskhodzhanov 6c66ad0d75 [Sanitizer RT] Put the Symbolizer module name string ownership in order
Reviewed at http://reviews.llvm.org/D8666

llvm-svn: 233687
2015-03-31 12:50:05 +00:00
Nick Lewycky 816e0eabb7 Add another sanity check for swapcontext, which is currently unsupported. Patch by Alexey Samsonov!
llvm-svn: 233413
2015-03-27 20:40:23 +00:00
Viktor Kutuzov eff2d98ecc [Tsan] Do not sanitize memset() and other functions during initialization
Differential Revision: http://reviews.llvm.org/D8544

llvm-svn: 233378
2015-03-27 14:12:28 +00:00
Dmitry Vyukov 2034ce665a tsan: don't write to meta shadow unnecessarily
If user does malloc(1<<30), the write to meta shadow
can cause excessive memory consumption.

llvm-svn: 233373
2015-03-27 12:22:44 +00:00
Alexey Samsonov 0781e98cc7 [UBSan] Explicitly list all supported OS/arch pairs supported by UBSan.
llvm-svn: 233295
2015-03-26 17:26:04 +00:00
Timur Iskhodzhanov fd3241528d [Sanitizer] Plug a leak in POSIXSymbolizer::FindModuleForAddress
It was happening when we looked up a PC for a module that was dlopen'ed/dlclose'd
after the last time we fetched the list of modules

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

llvm-svn: 233257
2015-03-26 07:14:29 +00:00
Alexey Samsonov 1c1407395f [LSan] Don't explicitly exclude LSan from Windows build - it should just produce dummy object files. NFC.
llvm-svn: 233231
2015-03-25 23:26:49 +00:00
Kuba Brecka b47f4ef508 On OS X, explicitly use libc++
For OS X builds, both Make and CMake, let's be very explicit about using
libc++ and libc++abi with:

1) -stdlib=libc++ in CFLAGS and LDFLAGS for all platforms
2) -lc++ in LDFLAGS for all platforms
3) switch from -undefined dynamic_lookup to -lc++abi for UBSan in
   Makefile-based builds

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

llvm-svn: 233215
2015-03-25 21:07:20 +00:00
Timur Iskhodzhanov 3e8d392e9a [Sanitizers coverage] Minor cleanup: reduce scope and visibility of one method and one variable
llvm-svn: 233212
2015-03-25 20:19:51 +00:00
Bill Seurer 92760a3551 [PowerPC]Fix sancov.py to once again support big endian
Some recent changes to sancov.py broke ASAN for big endian.  This fixes it.

http://reviews.llvm.org/D8594

llvm-svn: 233189
2015-03-25 14:56:02 +00:00
Alexander Potapenko 2dee295a89 [ASan] Suppress the deprecation warning from atos that breaks AtosSymbolizer on OSX 10.9
On OS X 10.9 /usr/bin/atos prints the following warning upon invocation:

 --
Warning: /usr/bin/atos is moving and will be removed from a future OS X release.
It is now available in the Xcode developer tools to be invoked via: `xcrun atos`
To silence this warning, pass the '-d' command-line flag to this tool.
 --

AtosSymbolizer treats the warning as the symbolization result for the first PC passed to the symbolizer. As a result, for each of the following PCs the file:line info for the previous PC is printed, e.g.:

==97926==ERROR: AddressSanitizer: attempting double-free on 0x60200000dfb0 in thread T0:
==97926==Using atos at user-specified path: /usr/bin/atos
==97926==Using dladdr symbolizer.
   #0 0x1007407e0 in  --  (+0x427e0)
   #1 0x1006f6f25 in wrap_free asan_malloc_mac.cc:114
   #2 0x7fff916e05fc in main atos-symbolizer.cc:17
   #3 0x0  (<unknown module>)

Unfortunately atos doesn't accept the -d switch on OSX versions other than 10.9, thus we have to check for the OSX version.

llvm-svn: 233180
2015-03-25 11:01:33 +00:00
Alexey Samsonov ee449b68d0 Revert "Revert "[UBSan] Use shared library for UBSan on OS X" and its followup"
Fix the build/tests by providing -lc++abi for UBSan runtime only.

llvm-svn: 233122
2015-03-24 21:57:07 +00:00
Justin Bogner cc7e7cabd5 Revert "[UBSan] Use shared library for UBSan on OS X" and its followup
This change caused test failures on darwin, and the followup which was
meant to fix those caused compiler-rt to start failing to link.
Reverting to get the build working again.

This reverts r233071 and r233036.

llvm-svn: 233097
2015-03-24 17:43:31 +00:00
Alexander Potapenko f7d32ccc00 [ASan] Do not link ASan OSX runtime with -lc++abi (which was added in r233036)
This should fix the OSX Jenkins build at http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA_check/

llvm-svn: 233071
2015-03-24 13:10:55 +00:00
Alexey Samsonov 6279a07eaa [TSan] Disable -Wno-maybe-uninitialized in yet another place.
llvm-svn: 233044
2015-03-24 00:38:43 +00:00
Alexey Samsonov 58e4835779 [TSan] Fixup for r233038: restrict the -Wno-maybe-uninitialized flag to GCC only.
llvm-svn: 233042
2015-03-23 23:44:38 +00:00
Alexey Samsonov 705c449af5 [ASan] Remove XFAIL from now passing test.
llvm-svn: 233040
2015-03-23 23:37:39 +00:00
Alexey Samsonov 543e966142 [TSan] Disable noisy GCC warning.
llvm-svn: 233038
2015-03-23 23:29:39 +00:00
Kostya Serebryany cd019f3655 [sanitizer] instead of comparing pointers to module_names while initializing coverage do a proper strcmp and strdup. NFC
llvm-svn: 233037
2015-03-23 23:19:13 +00:00
Alexey Samsonov c4eb977b0f [UBSan] Use shared library for UBSan on OS X (compiler-rt part).
Summary:
Switch to shared library for UBSan. Add support for building
UBSan on OSX and iossim by cargo-culting ASan build rules.

Test Plan: regression test suite

Reviewers: zaks.anna, kubabrecka

Subscribers: llvm-commits

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

llvm-svn: 233036
2015-03-23 23:14:16 +00:00
Alexey Samsonov 6a7ee6f460 [UBSan] Introduce "ubsan_standalone" library (compiler-rt part).
Get rid of "libclang_rt.san" library that used to contain
sanitizer_common pieces required by UBSan if it's used in a standalone
mode. Instead, build two variants of UBSan runtime: "ubsan" and
"ubsan_standalone" (same for "ubsan_cxx" and "ubsan_standalone_cxx").

Later "ubsan" and "ubsan_cxx" libraries will go away, as they will
embedded it into corresponding ASan runtimes.

llvm-svn: 233011
2015-03-23 20:05:53 +00:00
Viktor Kutuzov 60f0aa8a42 [Sanitizers] Fix internal_ftruncate() to work on FreeBSD
Differential Revision: http://reviews.llvm.org/D8551

llvm-svn: 233003
2015-03-23 19:44:35 +00:00
Viktor Kutuzov 838ea617d6 [Tsan] Fix the mmap_large.cc test to build on FreeBSD
Differential Revision: http://reviews.llvm.org/D8545

llvm-svn: 233001
2015-03-23 19:40:59 +00:00
Alexander Potapenko f0581dda03 [sanitizer] Fix file access modes in SanitizerCommon.InternalMmapWithOffset and SanitizerCommon.FileOps
llvm-svn: 232972
2015-03-23 17:55:19 +00:00
Alexander Potapenko b9c928bd10 [libsanitizer] Fix OpenFile() usage in TSan and DFSan.
This is a follow-up for r232936.

llvm-svn: 232937
2015-03-23 10:32:28 +00:00
Alexander Potapenko 141e420a81 [ASan] Distinguish between read, write and read-write file access modes in OpenFile.
This is to fix mapping coverage files into memory on OSX.

llvm-svn: 232936
2015-03-23 10:10:46 +00:00
Kuba Brecka 0e66c49d62 Fix a flaky heap-overflow-large.cc test
Reviewed at http://reviews.llvm.org/D8515

llvm-svn: 232920
2015-03-22 18:00:58 +00:00
Kuba Brecka eefb2e2703 Demangling for DlAddrSymbolizer
On OS X, dladdr() provides mangled names only, so we need need to demangle in
DlAddrSymbolizer::SymbolizePC.

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

llvm-svn: 232910
2015-03-22 11:38:55 +00:00
Kuba Brecka 0be4e0e0c1 Add AtosSymbolizer and DlAddrSymbolizer as fallbacks for OS X
This patch changes the symbolizer chain on OS X (which currently only uses 1
symbolizer at most) to use this behavior:

* By default, use LLVMSymbolizer -> DlAddrSymbolizer.
* If the llvm-symbolizer binary is not found, use AtosSymbolizer 
    -> DlAddrSymbolizer.
* If the user specifies ASAN_SYMBOLIZER_PATH=.../atos, then use AtosSymbolizer
    -> DlAddrSymbolizer.
* If neither llvm-symbolizer or atos is found, or external symbolication is
    disabled with ASAN_SYMBOLIZER_PATH="", use DlAddrSymbolizer.

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

llvm-svn: 232908
2015-03-22 10:02:50 +00:00
Kostya Serebryany 90bb050c54 [asan] update the sized_delete_test following the change of clang flags in r232788.
llvm-svn: 232845
2015-03-20 20:45:42 +00:00
Alexander Potapenko 24c262f213 [ASan] fix litling warnings for coverage-order-pcs.cc
llvm-svn: 232812
2015-03-20 14:11:05 +00:00
Alexander Potapenko 001deff940 [ASan] Move a couple of Posix-specific tests to Posix/
Add a comment about potential breakage of coverage-maybe-open-file.cc on Win

llvm-svn: 232809
2015-03-20 13:42:11 +00:00
Alexander Potapenko d5b3f7b125 [ASan] Move the coverage tests that work on Darwin to common testcase dir.
llvm-svn: 232808
2015-03-20 13:31:03 +00:00
Kostya Serebryany dcb54db809 [sanitizer] fix 'sancov.py merge' and add a test for it
llvm-svn: 232763
2015-03-19 21:01:27 +00:00
Kostya Serebryany eaec5b67e7 [sanitizer] trying to fix sancov.py with 32-bit python
llvm-svn: 232754
2015-03-19 19:52:30 +00:00
Kostya Serebryany 2d56abacd1 [sanitizer] change the sanitizer coverage format once again, this time adding a magic to the beginning of the file
llvm-svn: 232679
2015-03-18 22:03:39 +00:00