Commit Graph

5565 Commits

Author SHA1 Message Date
Timur Iskhodzhanov 8f40f03024 [ASan/Win] Add a test that makes sure coverage works at least in the simple cases
llvm-svn: 234496
2015-04-09 15:58:38 +00:00
Timur Iskhodzhanov 007435c1b7 [ASan/Win] Add more support for file operations
llvm-svn: 234494
2015-04-09 15:25:21 +00:00
Timur Iskhodzhanov 4eb084cda3 Use error_t rather than int in a couple of places where we handle files
llvm-svn: 234491
2015-04-09 14:49:53 +00:00
Timur Iskhodzhanov a6600a974a Use RenameFile instead of internal_rename in non-POSIX code
llvm-svn: 234490
2015-04-09 14:45:17 +00:00
Timur Iskhodzhanov e8a6fbbfd3 Use WriteToFile instead of internal_write in non-POSIX code
llvm-svn: 234487
2015-04-09 14:11:25 +00:00
Timur Iskhodzhanov 2b391694bf Use ReadFromFile instead of internal_read in non-POSIX code
llvm-svn: 234485
2015-04-09 13:38:14 +00:00
Timur Iskhodzhanov 5df4d0471f Move more POSIX-specific functions to sanitizer_posix.h
llvm-svn: 234482
2015-04-09 12:54:06 +00:00
Timur Iskhodzhanov 864308a78d Introduce CloseFile to be used instead of internal_close on non-POSIX
llvm-svn: 234481
2015-04-09 12:37:05 +00:00
Timur Iskhodzhanov 1b2ff68408 Replace a hard-coded constant with a named one
llvm-svn: 234479
2015-04-09 12:20:02 +00:00
Lorenzo Martignoni 59886f3c1a Differential Revision: http://reviews.llvm.org/D7249
llvm-svn: 234477
2015-04-09 11:42:33 +00:00
Kuba Brecka 2aa8c8fd17 [Sanitizer] Get rid of PlatformGetListOfModules
Moving the implementation of several functions from sanitizer_symbolizer.cc into sanitizer_symbolizer_libcdep.cc.

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

llvm-svn: 234472
2015-04-09 09:37:46 +00:00
Yury Gribov 8e49b47e0a [ASan] Only include rpc headers if they are available.
Reviewed at http://reviews.llvm.org/D8698

llvm-svn: 234470
2015-04-09 08:06:49 +00:00
Mohit K. Bhakkad 0eccfdc655 [Compiler-rt][MIPS] Fix for asan test suite build on mips64/mips64el
Patch by Sagar Thakur

Reviewers: dsanders
llvm-svn: 234468
2015-04-09 06:58:32 +00:00
Timur Iskhodzhanov c2c9ea5525 [Sanitizer RT] Get rid of internal_isatty
llvm-svn: 234423
2015-04-08 17:42:57 +00:00
Timur Iskhodzhanov 3745303c5b Move some POSIX-specific functions from sanitizer_libc.h to a new sanitizer_posix.h
llvm-svn: 234418
2015-04-08 17:08:24 +00:00
Timur Iskhodzhanov daa9e2d4e8 [Sanitizers] Make OpenFile more portable
llvm-svn: 234410
2015-04-08 16:03:22 +00:00
Dmitry Vyukov 8e39c404a0 tsan: handle async signals while blocked in pthread_cond_wait
Fixes https://code.google.com/p/thread-sanitizer/issues/detail?id=91

llvm-svn: 234394
2015-04-08 07:48:52 +00:00
Dmitry Vyukov 1e5b9f4131 sanitizer: new "strict_string_checks" run-time flag
This patch is related to Issue 346: moar string interceptors: strstr, strcasestr, strcspn, strpbrk
As was suggested in original review http://reviews.llvm.org/D6056 a new "strict_string_checks" run-time flag introduced.
The flag support applied for existing common, asan, msan and tsan interceptors. New asan tests added.

Change by Maria Guseva reviewed in http://reviews.llvm.org/D7123

llvm-svn: 234187
2015-04-06 18:00:26 +00:00
Timur Iskhodzhanov 1931b62632 Minor follow-up fix to r234150
llvm-svn: 234151
2015-04-06 12:54:06 +00:00
Timur Iskhodzhanov b97bcc4981 [ASan] Unify handling of loaded modules between POSIX and Windows
Reviewed at http://reviews.llvm.org/D8805

llvm-svn: 234150
2015-04-06 12:49:30 +00:00
Sergey Dmitrouk f3206d6278 Add hard float versions of FP to LL conversions
This adds hard-float implementation for the following builtins:

* __fixdfdi()
* __fixsfdi()
* __fixunsdfdi()
* __fixunssfdi()

The soft-float implementation does never raise floating point
exceptions, which doesn't allow clients to detect floating point
conversion errors.

I must mention that I had to refer to libgcc's implementation to
write these functions.

Related unit-tests of compiler-rt passed with these changes.

Patch was somewhat out-dated, so was updated locally without any
functional changes.

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

llvm-svn: 234148
2015-04-06 11:54:51 +00:00
Alexander Potapenko d403b29254 [ASan] Do not print thread IDs and stacks for unknown threads.
llvm-svn: 234147
2015-04-06 10:32:45 +00:00
Dmitry Vyukov 19300f856b tsan: fix munmap interceptor
MetaMap::ResetRange/FreeRange rounds the range up to at least kMetaShadowSize.
This is requried for e.g. free(malloc(0)). However, munmap returns EINVAL
and do not unmap any memory when length arguments is equal to 0.
So don't free meta shadow in this case as well.

llvm-svn: 234145
2015-04-06 07:57:32 +00:00
Justin Bogner 7759f1899e Add missing include
llvm-svn: 234037
2015-04-03 19:10:35 +00:00
Justin Bogner 8e1a2a3277 profile: Protect .gcda output with flock
This avoids crashing or corrupting data if multiple concurrent
processes write to the same .gcda file. This is hard to test, since
the previous behaviour was a data race that often worked out, and it
ignores errors in flock to fall back to the old racy behaviour so that
it won't degrade the behaviour on filesystems that don't support
flock.

llvm-svn: 234036
2015-04-03 18:55:44 +00:00
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
Justin Bogner eba5227ccd asan: Cargo cult the linux test changes in r232501 to the darwin tests
This gets check-asan working again on Darwin - it looks like it was
just an omission not to update this as part of r232501.

llvm-svn: 232672
2015-03-18 21:30:46 +00:00
Renato Golin d8a128aafb [ARM] Remove XFAIL from passing RT test
This test started passing without warning, so in theory, we shouldn't mark
is as XPASS, but the buildbots are red and there's been an uncaught regression
meanwhile. Since it's passing on {ARM,Thumb2} x {NEON,VFPv3}, I'll risk future
failures for the benefit of getting the bots green again.

llvm-svn: 232642
2015-03-18 15:42:15 +00:00
Kostya Serebryany cba49d4b04 [sanitizer] add run-time a flag coverage_order_pcs. When true, the PCs are dumped in the order of their appearance
llvm-svn: 232573
2015-03-18 00:23:44 +00:00
Alexey Samsonov c9d9610317 Improve SUMMARY reporting in sanitizers.
Make sure SUMMARY is always reported unless print_summary flag is set to
false, even if symbolizer is unavailable or report stack trace is empty.
If file/line info for PC can't be evaluated, print module name/offset
like we do in stack trace.

llvm-svn: 232567
2015-03-17 23:46:06 +00:00
Kostya Serebryany 9f1243ee49 [sanitizer] change the format of coverage dump: instead of always dumping 32-bit offsets dump 32-bit offsets on 32-bit arch and 64-bit offsets on 64-bit arch. Also add the 'bits' parameter to sancov.py. This is a user-visible interface change.
llvm-svn: 232555
2015-03-17 22:09:19 +00:00
Dmitry Vyukov 27c50f4f02 asan: remove left-over code from submitted in rev r232501
__sanitizer_cov_hint is part of a different functionality
and was not intended to be submitted.

llvm-svn: 232506
2015-03-17 17:30:41 +00:00
Dmitry Vyukov 6bd917a31f asan: optimization experiments
The experiments can be used to evaluate potential optimizations that remove
instrumentation (assess false negatives). Instead of completely removing
some instrumentation, you set Exp to a non-zero value (mask of optimization
experiments that want to remove instrumentation of this instruction).
If Exp is non-zero, this pass will emit special calls into runtime
(e.g. __asan_report_exp_load1 instead of __asan_report_load1). These calls
make runtime terminate the program in a special way (with a different
exit status). Then you run the new compiler on a buggy corpus, collect
the special terminations (ideally, you don't see them at all -- no false
negatives) and make the decision on the optimization.

The exact reaction to experiments in runtime is not implemented in this patch.
It will be defined and implemented in a subsequent patch.

http://reviews.llvm.org/D8198

llvm-svn: 232501
2015-03-17 16:59:11 +00:00
Timur Iskhodzhanov d58230b9dc [ASan/Win] Fix a CHECK failure when an exception is thrown from a callback passed to BindIoCompletionCallback
This also simplifies how we handle QueueUserWorkItem

llvm-svn: 232499
2015-03-17 16:50:59 +00:00
Peter Collingbourne 3fc1563ad7 CFI: Make check-cfi depend on libLTO on Darwin.
llvm-svn: 232426
2015-03-16 22:00:04 +00:00
Viktor Kutuzov a7d323e996 [Tsan] Do not sanitize memcpy() during thread initialization on FreeBSD
Differential Revision: http://reviews.llvm.org/D8324

llvm-svn: 232381
2015-03-16 14:42:21 +00:00
Timur Iskhodzhanov 817ac724e2 [ASan] NFC: Factor out platform-specific interceptors
Reviewed at http://reviews.llvm.org/D8321

llvm-svn: 232377
2015-03-16 14:22:53 +00:00
Peter Collingbourne 678e78ca95 CFI: Add test for bad cast checks.
llvm-svn: 232242
2015-03-14 02:42:39 +00:00
Peter Collingbourne ca1c7793b1 CFI: Add a test for distinguishing between non-overriding siblings.
llvm-svn: 232238
2015-03-14 01:35:33 +00:00
Reid Kleckner a1410321f6 Translate some MSVC CMAKE_*_FLAGS to clang flags in clang_compile
Passing MSVC-style cflags to the gcc-style clang driver will almost
always end badly. Just translate a couple of simple flags used by the
base CMake cflags like /D, /U, and /O.

llvm-svn: 232219
2015-03-13 21:39:29 +00:00
Viktor Kutuzov 281347aa59 [Tsan] Fix test.h to work on FreeBSD
Differential Revision: http://reviews.llvm.org/D8303

llvm-svn: 232167
2015-03-13 14:08:55 +00:00
Joerg Sonnenberger 1aa3faaca2 We want single precision here.
llvm-svn: 232125
2015-03-13 00:18:28 +00:00
Ed Maste 9197c8dad0 Use signed int implementation for __fixint
llvm-svn: 232107
2015-03-12 21:36:10 +00:00
Alexey Samsonov 59c57cd89b Update copyright year to 2015.
llvm-svn: 232089
2015-03-12 19:53:06 +00:00
Viktor Kutuzov 285dd51b7b [Tsan] Do not declare std_suppressions when not used
Differential Revision: http://reviews.llvm.org/D8288

llvm-svn: 232074
2015-03-12 18:14:42 +00:00
Viktor Kutuzov 07a21dc46d [Tsan] Adjust SA_SIGINFO and SIG_SETMASK values on FreeBSD.
Differential Revision: http://reviews.llvm.org/D8176

llvm-svn: 232073
2015-03-12 18:12:43 +00:00
Viktor Kutuzov 74c2001f3f [Sanitizers] Fix sanitizers to build on FreeBSD.
Differential Revision: http://reviews.llvm.org/D8175

llvm-svn: 232072
2015-03-12 18:10:06 +00:00
Dmitry Vyukov b75212878f tsan: fix a bug in MetaMap::ResetRange
The bug was uncovered by NegativeTests.MmapTest from
data-race-test suite, so port it as well.

llvm-svn: 232032
2015-03-12 12:48:19 +00:00
Dmitry Vyukov a60829a1b6 tsan: fix crash during __tsan_java_move
Munmap interceptor did not reset meta shadow for the range,
and __tsan_java_move crashed because it encountered
non-zero meta shadow for the destination.

llvm-svn: 232029
2015-03-12 11:24:16 +00:00
Kuba Brecka 656e184f6c Adding the implementation of atos and dladdr symbolizers for OS X.
They are currently still *not* used, "llvm-symbolizer" is still the default symbolizer on OS X.

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

llvm-svn: 232026
2015-03-12 10:53:18 +00:00
Kuba Brecka 3c53266ca8 Make the UBSan coverage-levels.cc test be Linux specific
Reviewed at http://reviews.llvm.org/D8278

llvm-svn: 232025
2015-03-12 10:44:34 +00:00
Joerg Sonnenberger c8f5c18714 Be nicer to C90 environments and avoid the declaration of variables in for
header.

From Alexander Esilevich.

llvm-svn: 231975
2015-03-11 22:06:53 +00:00
Joerg Sonnenberger 099de18c42 Always include stddef.h to make sure size_t exists.
From Alexander Esilevich.

llvm-svn: 231972
2015-03-11 21:58:40 +00:00
Joerg Sonnenberger 91bd698eaf Refactor float to integer conversion to share the same code.
80bit Intel/PPC long double is excluded due to lacking support
for the abstraction. Consistently provide saturation logic.
Extend to long double on 128bit IEEE extended platforms.

Initial patch with test cases from GuanHong Liu.
Reviewed by Steve Canon.

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

llvm-svn: 231965
2015-03-11 21:13:56 +00:00
Timur Iskhodzhanov 81514e0660 [ASan/Win] Fix a CHECK failure when an exception is thrown from a callback passed to QueueUserWorkItem
llvm-svn: 231947
2015-03-11 17:47:10 +00:00
Dmitry Vyukov 2d78c6371d asan: fix leak test for power platform
Power is 64-bit but does not support leak detection,
so this test fails. Use the more robust leak-detection
predicate instead.

llvm-svn: 231782
2015-03-10 10:36:06 +00:00
Kostya Serebryany 48a4023f40 [sanitizer] fix instrumentation with -mllvm -sanitizer-coverage-block-threshold=0 to actually do something useful.
llvm-svn: 231736
2015-03-10 01:58:27 +00:00
Alexey Samsonov de34ec0193 Revert "Revert "[UBSan] Add testcases for -fsanitize=shift-base and -fsanitize=shift-exponent.""
Re-land r231151 now that -fsanitize=shift-base implementation should not
introduce undefined behavior.

llvm-svn: 231712
2015-03-09 21:50:40 +00:00
Kuba Brecka ae219d3d3c Symbolizer refactoring: Merge common parts of POSIXSymbolizer and WinSymbolizer
Reviewed at http://reviews.llvm.org/D8105

llvm-svn: 231680
2015-03-09 18:36:28 +00:00
Joerg Sonnenberger ef24b4171d At least on NetBSD, sys/errno.h and errno.h are different, so use the
correct header to get errno.

llvm-svn: 231647
2015-03-09 11:23:29 +00:00
Joerg Sonnenberger 6d7cb4668f Avoid warnings on !PowerPC
llvm-svn: 231609
2015-03-08 21:08:39 +00:00
Joerg Sonnenberger 531cf7f491 Don't produce warnings on !PowerPC.
llvm-svn: 231608
2015-03-08 21:06:58 +00:00
Kuba Brecka 133b615558 Adding sanitizer_symbolizer_win.h to CMakeLists.txt
llvm-svn: 231562
2015-03-07 11:04:36 +00:00
Kostya Serebryany 136494c256 [asan] Fix 2 problems in nohugepage_test.
1. /proc/self/smaps may be bigger than 1 << 14.  On my machine, it is
26KB.
2. The read system call may return a partially filled buffer.  We need
to check the return value from read.

Patch by H.J. Lu

llvm-svn: 231502
2015-03-06 19:33:58 +00:00
Sergey Matveev 4a792988b3 [asan] Allow users of asan_symbolize.py to forbid fallback to atos/addr2line.
llvm-svn: 231492
2015-03-06 17:05:28 +00:00
Kuba Brecka 9930aaa9ed Symbolizer refactoring: Make WinSymbolizer use SymbolizerTool interface
Reviewed at http://reviews.llvm.org/D8089

llvm-svn: 231478
2015-03-06 14:33:56 +00:00
Dmitry Vyukov 0fc13a9a82 asan: fix comment formatting
As per comments in http://reviews.llvm.org/D8032

llvm-svn: 231457
2015-03-06 08:43:44 +00:00
Kuba Brecka da0204d05f Add a symbolizer testcase for closed stdin/stdout
Reviewed at http://reviews.llvm.org/D7973

llvm-svn: 231429
2015-03-05 23:41:47 +00:00
Kuba Brecka 334f9c4ed8 Print out which symbolizer are we using when verbosity >= 2
Reviewed at http://reviews.llvm.org/D8087

llvm-svn: 231428
2015-03-05 23:38:23 +00:00
Kostya Serebryany 769ddaa2d4 [sanitizer] Reconstruct the function that dumps block/edge coverage, hopefully making it more robust. Also increase the allowed coverage size on 32-bit.
llvm-svn: 231413
2015-03-05 22:19:25 +00:00
Alexey Samsonov 4833452c0c Revert "[UBSan] Add testcases for -fsanitize=shift-base and -fsanitize=shift-exponent."
The test case fails on AArch64.

llvm-svn: 231410
2015-03-05 21:57:47 +00:00
Joerg Sonnenberger 8a1f0446c0 Move use of __builtin_longjmp under the same conditions as the only
caller of the function.

llvm-svn: 231402
2015-03-05 20:17:05 +00:00
Dmitry Vyukov 72f169797e tsan: fix signal handling during stop-the-world
Long story short: stop-the-world briefly resets SIGSEGV handler to SIG_DFL.
This breaks programs that handle and continue after SIGSEGV (namely JVM).
See the test and comments for details.

This is reincarnation of reverted r229678 (http://reviews.llvm.org/D7722).
Changed:
- execute TracerThreadDieCallback only on tracer thread
- reset global data in TracerThreadSignalHandler/TracerThreadDieCallback
- handle EINTR from waitpid

Add 3 new test:
- SIGSEGV during leak checking
- StopTheWorld operation during signal storm from an external process
- StopTheWorld operation when the program generates and handles SIGSEGVs

http://reviews.llvm.org/D8032

llvm-svn: 231367
2015-03-05 14:37:28 +00:00
Kuba Brecka 5c4ce05d6a Symbolizer refactoring: Link symbolizer tools into a fallback chain
Reviewed at http://reviews.llvm.org/D8049

llvm-svn: 231361
2015-03-05 09:47:13 +00:00
Kostya Serebryany c1d6ab9a1e [sanitizer] add a run-time flag to dump the coverage counter bitset
llvm-svn: 231343
2015-03-05 02:48:51 +00:00
Kostya Serebryany c89aa6d697 [sanitizer] use simpler symbolizer interface (GetModuleNameForPc) where applicable
llvm-svn: 231337
2015-03-05 01:30:36 +00:00
Alexey Samsonov f3761c36f2 [ASan] Fix asan-(32|64)-bits lit tests feature.
It broke down at some point, and all tests with
  REQUIRES: asan-(32|64)-bits
line stopped being executed. Restore the intended behavior.

llvm-svn: 231325
2015-03-05 00:33:11 +00:00
Kostya Serebryany 07aee9c2c6 [sanitizer] when dumping coverage bitset, dump seperate file for every module, instead of dumping a single combined bitset
llvm-svn: 231319
2015-03-04 23:41:55 +00:00
Alexey Samsonov 27f4571a5a [Sanitizer] Fix/suppress compiler warnings in unit tests.
llvm-svn: 231293
2015-03-04 21:54:20 +00:00
Alexey Samsonov 00fb6c9da0 Exclude LLVM sources from lint check.
Checking files from different repository is not nice, and LLVM code
follows its own style guide anyway.

llvm-svn: 231289
2015-03-04 21:38:10 +00:00
Kostya Serebryany 46e5d5c669 [sanitizer] Since x32 runs under 64-bit kernel, GetKernelAreaSize should return 0
llvm-svn: 231283
2015-03-04 20:32:06 +00:00
Kostya Serebryany 4bdf5ada18 [asan] more fixes for x32, patches by H.J. Lu
llvm-svn: 231174
2015-03-03 23:46:40 +00:00
Kostya Serebryany 92b8ab502c [asan] attempting to fix the windows build
llvm-svn: 231171
2015-03-03 23:38:24 +00:00
Kostya Serebryany be5e0ed919 [sanitizer/coverage] Add AFL-style coverage counters (search heuristic for fuzzing).
Introduce -mllvm -sanitizer-coverage-8bit-counters=1
which adds imprecise thread-unfriendly 8-bit coverage counters.

The run-time library maps these 8-bit counters to 8-bit bitsets in the same way
AFL (http://lcamtuf.coredump.cx/afl/technical_details.txt) does:
counter values are divided into 8 ranges and based on the counter
value one of the bits in the bitset is set.
The AFL ranges are used here: 1, 2, 3, 4-7, 8-15, 16-31, 32-127, 128+.

These counters provide a search heuristic for single-threaded
coverage-guided fuzzers, we do not expect them to be useful for other purposes.

Depending on the value of -fsanitize-coverage=[123] flag,
these counters will be added to the function entry blocks (=1),
every basic block (=2), or every edge (=3).

Use these counters as an optional search heuristic in the Fuzzer library.
Add a test where this heuristic is critical.

llvm-svn: 231166
2015-03-03 23:27:02 +00:00
Kuba Brecka b126894b96 Symbolizer refactoring: Unify access to symbolizer tools from POSIXSymbolizer
Reviewed at http://reviews.llvm.org/D8029

llvm-svn: 231162
2015-03-03 23:13:02 +00:00
Alexey Samsonov 987666d57c [UBSan] Add testcases for -fsanitize=shift-base and -fsanitize=shift-exponent.
llvm-svn: 231151
2015-03-03 22:15:44 +00:00
Kuba Brecka e87a26c0ed Symbolizer refactoring: Turn FillAddressAndModuleInfo into FillModuleInfo
Reviewed at http://reviews.llvm.org/D8020

llvm-svn: 231061
2015-03-03 09:18:44 +00:00
Kostya Serebryany 3e7825efb5 [asan] Since x32 has 32-bit pointers, it should use the same code sequence as ia32 for AddressSanitizer asm_flags test. Patch by H.J. Lu
llvm-svn: 231052
2015-03-03 02:45:21 +00:00
Kuba Brecka 249a9e3a7f Symbolizer refactoring: Make LibbacktraceSymbolizer adopt the SymbolizerTool interface
Reviewed at http://reviews.llvm.org/D7971

llvm-svn: 231032
2015-03-02 22:56:25 +00:00
Kuba Brecka 59e8c3b342 Symbolizer refactoring: ExtractToken and friends
Reviewed at http://reviews.llvm.org/D7867

llvm-svn: 231027
2015-03-02 22:15:14 +00:00
Alexey Samsonov 990864018f [Sanitizer] Run test/sanitizer_common lit tests on all supported architectures.
llvm-svn: 231025
2015-03-02 22:03:52 +00:00
Kuba Brecka 898270513d Symbolizer refactoring: Move internals to separate files
Reviewed at http://reviews.llvm.org/D7972

llvm-svn: 231014
2015-03-02 21:15:09 +00:00
Renato Golin 26af9c9024 Allow compiler-rt build on Bitrig
This is the only patch Bitrig uses for compiler-rt. It adds support
for Bitrig/arm in the clear cache code.

Patch by Patrick Wildt.

llvm-svn: 231012
2015-03-02 21:02:43 +00:00
Timur Iskhodzhanov 18cfba9fa4 [ASan/Win] Work around PR22545: call LLVM global_dtors in the MD atexit()
llvm-svn: 231000
2015-03-02 19:41:09 +00:00
Alexey Samsonov d06aa3dc00 [MSan] Remove explicit -m64 from RUN lines.
Target-specific flags should usually be configured by CMake/lit.

llvm-svn: 230999
2015-03-02 19:34:27 +00:00
Alexey Samsonov 3e40703ab5 [DFSan] Remove explicit -m64 from RUN lines.
Target-specific flags should usually be configured by CMake/lit.

llvm-svn: 230997
2015-03-02 19:34:06 +00:00
Alexey Samsonov 1ce8745b77 [Sanitizer] Restrict open_memstream to x86_64. Fixes PR22714.
llvm-svn: 230996
2015-03-02 19:34:02 +00:00
Alexey Samsonov 1be519876d [Sanitizer] Fix StripPathPrefix function and improve test case.
llvm-svn: 230986
2015-03-02 18:55:46 +00:00
Dmitry Vyukov df01bdca70 asan: fix windows build after commit 230978
llvm-svn: 230980
2015-03-02 17:45:18 +00:00
Dmitry Vyukov b79ac88155 asan: fix signal handling during stoptheworld
The problem is that without SA_RESTORER flag, kernel ignores the handler. So tracer actually did not setup any handler.
Add SA_RESTORER flag when setting up handlers.
Add a test that causes SIGSEGV in stoptheworld callback.
Move SignalContext from asan to sanitizer_common to print better diagnostics about signal in the tracer thread.

http://reviews.llvm.org/D8005

llvm-svn: 230978
2015-03-02 17:36:02 +00:00
Sergey Matveev 348800b3d9 [asan] Demote "trying to poison/unpoison memory region" messages...
... to verbosity level 3. Because log spam.

llvm-svn: 230974
2015-03-02 17:13:38 +00:00