Commit Graph

7624 Commits

Author SHA1 Message Date
Kostya Serebryany d77e8c0269 [sanitizer] fix a potential buffer overflow due to __sanitizer_symbolize_pc (need to put a zero after strncmp). LOL
llvm-svn: 281015
2016-09-09 02:13:27 +00:00
Evgeniy Stepanov 55f9f18cb2 Fix tsan-go build.
Disable the new abort-in-SIGABRT code under SANITIZER_GO.

llvm-svn: 280980
2016-09-08 19:16:01 +00:00
Bill Seurer ba7c5cfbbb [powerpc] Move #if to appease warnings-as-errors tests
Previous patch added a #if which causes some unused identifier warnings.

llvm-svn: 280976
2016-09-08 18:09:47 +00:00
Renato Golin 6f605133dd Revert "[XRay] ARM 32-bit no-Thumb support in compiler-rt"
This reverts commit r280890, as the related LLVM commit broke the thumb bots.

llvm-svn: 280969
2016-09-08 17:13:15 +00:00
Reid Kleckner 490ccc9cc7 Fix linker warning about sanitizer_common_nolibc functions on Windows
llvm-svn: 280962
2016-09-08 16:46:06 +00:00
Reid Kleckner dd16896324 Really fix warnings about passing -std=gnu99 to MSVC
llvm-svn: 280958
2016-09-08 16:25:34 +00:00
Qin Zhao 0ab52b97e8 Revert "[ESan][MIPS] Adds support for MIPS64"
Summary:
This reverts commit 62b3eecdbe72af0255f0639b0446087a47efbf48. (D23799)

The CL cause 13 ESan test failure on x86_64:
Failing Tests (13):
    EfficiencySanitizer-x86_64 :: TestCases/large-stack-linux.c
    EfficiencySanitizer-x86_64 :: TestCases/libc-intercept.c
    EfficiencySanitizer-x86_64 :: TestCases/mmap-shadow-conflict.c
    EfficiencySanitizer-x86_64 :: TestCases/struct-simple.cpp
    EfficiencySanitizer-x86_64 :: TestCases/verbose-simple.c
    EfficiencySanitizer-x86_64 :: TestCases/workingset-early-fault.c
    EfficiencySanitizer-x86_64 :: TestCases/workingset-memset.cpp
    EfficiencySanitizer-x86_64 :: TestCases/workingset-midreport.cpp
    EfficiencySanitizer-x86_64 :: TestCases/workingset-samples.cpp
    EfficiencySanitizer-x86_64 :: TestCases/workingset-signal-posix.cpp
    EfficiencySanitizer-x86_64 :: TestCases/workingset-simple.cpp
    EfficiencySanitizer-x86_64 :: Unit/circular_buffer.cpp
    EfficiencySanitizer-x86_64 :: Unit/hashtable.cpp

  Unexpected Failures: 13

Reviewers: bruening, slthakur

Subscribers: sdardis, kubabrecka, beanz

Differential Revision: https://reviews.llvm.org/D24350

llvm-svn: 280954
2016-09-08 16:09:46 +00:00
Francis Ricci 0b6f487c63 [compiler-rt] Don't use -fPIC when building for Windows
Summary: This flag doesn't make sense on Windows systems.

Reviewers: beanz, kubabrecka, compnerd

Subscribers: dberris, llvm-commits, beanz

Differential Revision: https://reviews.llvm.org/D24320

llvm-svn: 280953
2016-09-08 15:57:22 +00:00
Kuba Brecka 8651c04ce0 [asan] Fix handle_abort_on_error.cc test on Darwin
r280885 added a testcase for handle_abort, which is broken on macOS, let’s add this support into sanitizer_mac.cc.

Differential Revision: https://reviews.llvm.org/D24344

llvm-svn: 280945
2016-09-08 14:32:11 +00:00
Filipe Cabecinhas 3e848ea586 [asan] Handle SIGBART signal description. (found by buildbot)
llvm-svn: 280934
2016-09-08 13:28:26 +00:00
Filipe Cabecinhas 1989be7cf0 [asan] Reify ErrorDeadlySignal
Summary: Keep reifying other errors.

Reviewers: kcc, samsonov

Subscribers: llvm-commits, kubabrecka

Differential Revision: https://reviews.llvm.org/D23873

llvm-svn: 280930
2016-09-08 12:58:15 +00:00
Kuba Brecka 419ebb2891 [tsan] Support C++11 call_once in TSan on Darwin
This patch adds a wrapper for call_once, which uses an already-compiled helper __call_once with an atomic release which is invisible to TSan. To avoid false positives, the interceptor performs an explicit atomic release in the callback wrapper.

Differential Revision: https://reviews.llvm.org/D24188

llvm-svn: 280920
2016-09-08 10:15:20 +00:00
Vitaly Buka b638c48819 [asan] Test that asan does not report use-after-scope if program jumped over variable declaration.
Summary:
Test to check if PR28267 workaround works.

PR28267
PR27453

Reviewers: eugenis

Subscribers: llvm-commits, kubabrecka

Differential Revision: https://reviews.llvm.org/D24323

llvm-svn: 280908
2016-09-08 06:43:02 +00:00
Nico Weber 81291a0fce Correctly escape %.
Found be an MSVC warning; I filed PR30320 for adding a similar warning to clang.

llvm-svn: 280900
2016-09-08 01:46:52 +00:00
Dean Michael Berris 5332645c6d [XRay] ARM 32-bit no-Thumb support in compiler-rt
This is a port of XRay to ARM 32-bit, without Thumb support yet.
This is one of 3 commits to different repositories of XRay ARM port. The
other 2 are:

1. https://reviews.llvm.org/D23931 (LLVM)
2. https://reviews.llvm.org/D23932 (Clang test)

Differential Revision: https://reviews.llvm.org/D23933

llvm-svn: 280890
2016-09-08 00:28:26 +00:00
Evgeniy Stepanov 337e40f157 [sanitizer] Fix a conflict between abort_on_error and handle_abort.
Reset the SIGABRT signal handler before calling abort().

Also, change the error message when catching SIGABRT to say "ABRT"
instead of "SEGV".

llvm-svn: 280885
2016-09-07 23:40:53 +00:00
Evgeniy Stepanov e29f05d037 [asan] Fix build on Linux.
llvm-svn: 280881
2016-09-07 23:19:16 +00:00
Saleem Abdulrasool d14c2c0139 builtins: make sure that flags is setup properly for __clear_cache
On Linux ARM, the syscall will take 3 arguments (start, end, flags).  Ensure
that we do not pass garbage to the flags, which can cause the cacheflush call to
fail, and therefore cause an abort at runtime.

llvm-svn: 280877
2016-09-07 22:59:54 +00:00
Evgeniy Stepanov 3989c9f96f [asan] Fix a crash in GetCurrentThread() before init.
Android-specific code in GetCurrentThread() does not handle the situation when there is no
ThreadContext for the current thread. This happens if the current thread is requested before the
main thread is added to the registry. 64-bit allocator does that to record map/unmap stats during
initialization.

llvm-svn: 280876
2016-09-07 22:57:06 +00:00
Evgeniy Stepanov 0b2dba1841 [asan] Add openlog() on Android.
Normally, syslog() uses argv[0] for the log tag; bionic, however,
would crash in syslog() before libc constructor unless the log
tag is explicitly set with openlog().

llvm-svn: 280875
2016-09-07 22:56:02 +00:00
Francis Ricci 52fdd22250 [compiler-rt] Allow sanitizers to be compiled for windows with clang
Summary:
A few small changes required to permit building the sanitizers
with Clang instead of only with MSVC.

Reviewers: compnerd, beanz, rnk

Subscribers: beanz, timurrrr, kubabrecka, dberris, llvm-commits

Differential Revision: https://reviews.llvm.org/D24092

llvm-svn: 280863
2016-09-07 21:03:22 +00:00
Francis Ricci e7729c8468 [compiler-rt] Fix library suffixes on windows
Summary:
Make sure that windows libraries contain the suffixes expected by clang.
This is expecially important when compiling the windows builtins with
clang, as cmake will use .a as the suffix by default.

Reviewers: beanz, compnerd

Subscribers: llvm-commits, dberris

Differential Revision: https://reviews.llvm.org/D24046

llvm-svn: 280854
2016-09-07 20:32:48 +00:00
Bill Seurer 14f382065f [powerpc] Move #if to appease warnings-as-errors tests
Previous patch added a #if which caused a variable and function
to be unused.

llvm-svn: 280846
2016-09-07 19:44:04 +00:00
Bill Seurer f2a02894c7 [powerpc] Disable ManyThreadsWithStatsStressTest test for ppc64
Since r279664 this test causes frequent failures of test runs for ppc64le and
occasional failures for ppc64be which makes buildbot results unreliable.  If
the underlying problem is fixed it can be re-enabled.

llvm-svn: 280823
2016-09-07 16:30:31 +00:00
Filipe Cabecinhas 25ad7b52c3 [asan] Reify ErrorNewDeleteSizeMismatch
Summary: Keep reifying other errors.

Reviewers: kcc, samsonov

Subscribers: llvm-commits, kubabrecka

Differential Revision: https://reviews.llvm.org/D23874

llvm-svn: 280812
2016-09-07 14:20:54 +00:00
Sagar Thakur 41f08b4422 [ESan][MIPS] Adds support for MIPS64
With this patch 10 out of 13 tests are passing.

Following is the list of failing tests:

    struct-simple.cpp
    workingset-signal-posix.cpp
    mmap-shadow-conflict.c

Reviewed by bruening
Differential: D23799

llvm-svn: 280795
2016-09-07 09:09:03 +00:00
Krzysztof Parzyszek 6e2e0e8b8f Add #include <cstdio> to unbreak build (missing definition of stderr)
llvm-svn: 280714
2016-09-06 16:26:49 +00:00
Dmitry Vyukov 3c503d1b52 asan: allow __asan_{before,after}_dynamic_init without registered globals
When optimizing, GCC optimizes away aggressively unused static globals.
The __asan_before_dynamic_init/__asan_after_dynamic_init calls are placed
in static constructor earlier while the registration of the globals is done
later in the compilation process.  If all the globals with
dynamic initialization are optimized away from some particular TU in between
those two, libasan can fail on an assertion that dynamic_init_globals is
empty.

While I'm going to commit a GCC change which will remove the
__asan_before_dynamic_init/__asan_after_dynamic_init in many cases when this
happens (basically if the optimizers can prove there are no memory
references in between the two calls), there are still testcases where such
pair of calls is left, e.g. for
struct S { S () { asm volatile ("" : : : "memory"); } };
static S c;

int
main ()
{
  return 0;
}
with -O2 -fsanitize=address and ASAN_OPTIONS=check_initialization_order=true
this still fails the assertion.  Trying to avoid this problem on the
compiler side would decrease code quality I'm afraid, whether it is making
sure for -fsanitize=address we keep around at least one dynamically
initialized global if the
__asan_before_dynamic_init/__asan_after_dynamic_init pair has been emitted,
or adding some artificial global which would be used as the condition for
those calls etc.
So, can the assertion be instead just removed, this really shouldn't slow
down the calls measurably (for __asan_before_dynamic_init it is even
cheaper) and the assertion doesn't check something worthwhile anyway (it is
sufficient if there is a single dynamically initialized global in any other
TU to make it happy).

Details in http://gcc.gnu.org/PR77396

Author: Jakub Jelinek
llvm-svn: 280657
2016-09-05 12:22:56 +00:00
Filipe Cabecinhas 3121ddf7fa [asan] Move scariness_score_test.cc to a common subdirectory
Summary:
Only one of the tests in it doesn't work on OS X.
On Windows it seems that everything that is being moved is also
supported.

The abort() test wasn't copied over (original case 22). This is because
it doesn't work on OS X.

Reviewers: kcc, eugenis, vitalybuka

Subscribers: kubabrecka, llvm-commits
llvm-svn: 280469
2016-09-02 07:18:35 +00:00
Reid Kleckner 0c4dd8de47 Un-XFAIL cfi/stats.cpp, it passes since fixing llvm-symbolizer to look for dwarf again
llvm-svn: 280422
2016-09-01 22:46:26 +00:00
Chris Bieneman 90646fe815 [CMake] Add option (defaulted off) to exclude atomic.c
The atomic builtin source is problematic when cross-compiling builtins because it requires a variable and sometimes large set of system headers. This option allows users to optionally prevent it from being built.

llvm-svn: 280416
2016-09-01 21:05:49 +00:00
Evgeniy Stepanov bc555b7ebe [tsan] Bump stack frame size limit.
llvm-svn: 280411
2016-09-01 20:43:59 +00:00
Filipe Cabecinhas d2fb1e4a6c Revert "Copy over most of the scariness_score test to the general tests"
This reverts commit r280361 until we have the proper change in place.

llvm-svn: 280398
2016-09-01 18:40:12 +00:00
Chris Bieneman 5f2546273d [CMake] Adding compiler-rt-test-depends target
This exposes a target for building the compiler-rt test dependencies and matches llvm-test-depends.

llvm-svn: 280393
2016-09-01 18:26:51 +00:00
Reid Kleckner 507ba20907 Fix dll_host.cc test after adding div and gep trace coverage points
llvm-svn: 280387
2016-09-01 18:08:05 +00:00
Saleem Abdulrasool b939a7fde8 build: profile is not a sanitizer
There was an invalid entry in the sanitizer list, remove it.  This has no effect
on the building, just removes the definition of a cached variable.

llvm-svn: 280378
2016-09-01 15:05:36 +00:00
Renato Golin fbd3de7851 Try to fix another profile test
Another CFG optimisation patch (280364) has broken bad profile tests, and this
is a similar attempt to fix the test without changing the semantics.

llvm-svn: 280373
2016-09-01 14:44:02 +00:00
Filipe Cabecinhas 9512821e22 Remove extra scariness.Clear() call.
llvm-svn: 280372
2016-09-01 14:41:17 +00:00
Renato Golin 0f298a2655 Fix profile test assuming dumb compiler
Commit r280364 has introduced some call-graph optmisations making a profiler
test "fail" due to not expecting the compiler to be "smart", and fold constants
across functions. This commit works around the issue, leaving the origial
semantics intact.

llvm-svn: 280365
2016-09-01 13:45:47 +00:00
Filipe Cabecinhas f1fb439d31 Clear scariness score when initializing ErrorDoubleFree
llvm-svn: 280363
2016-09-01 12:51:58 +00:00
Filipe Cabecinhas 6e903def8b Copy over most of the scariness_score test to the general tests
The abort() test wasn't copied over (original case 22). This is because
it doesn't work on OS X.

If theres no buildbot problem with this test later today, I will
minimize the Linux version.

llvm-svn: 280361
2016-09-01 12:29:13 +00:00
Ivan Krasin f3e82f1418 Fix the use of unitialized value while reporting double free in ASAN.
Summary:
This is a follow up to https://reviews.llvm.org/rL280201 where this issue was introduced.

ASAN tests failed:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/25219/steps/run%20asan%20tests/logs/stdio

Reviewers: filcab

Subscribers: kubabrecka

Differential Revision: https://reviews.llvm.org/D24109

llvm-svn: 280325
2016-08-31 23:42:27 +00:00
Kostya Serebryany 2700bd831a [sanitizer] extend SizeClassMap to take more template parameters, add VeryCompactSizeClassMap for testing purposes
llvm-svn: 280266
2016-08-31 17:52:55 +00:00
Filipe Cabecinhas 453b55551f Fix buildbot bug: Wasn't printing scariness for DoubleFree
llvm-svn: 280213
2016-08-31 09:39:47 +00:00
Filipe Cabecinhas b16672d91d Reify ErrorDoubleFree
Summary: Keep reifying other errors.

Reviewers: kcc, samsonov

Subscribers: llvm-commits, kubabrecka

Differential Revision: https://reviews.llvm.org/D23717

llvm-svn: 280201
2016-08-31 07:38:09 +00:00
Kostya Serebryany 4fd30769c1 [sanitizer] remove kBatchClassID that is not used any more; NFC
llvm-svn: 280185
2016-08-31 00:37:33 +00:00
Saleem Abdulrasool 000b071b07 stats: define WIN32_LEAN_AND_MEAN when including windows.h
Reduce the amount of the header that we end up including in the build.  The
additional definitions are not necessary.

llvm-svn: 280146
2016-08-30 20:15:46 +00:00
Saleem Abdulrasool 6ca511439d profile: add missing include for Windows
Add a missing Windows.h which is needed for the windows type usage in the TU
(e.g. HANDLE).

llvm-svn: 280145
2016-08-30 20:15:44 +00:00
Filipe Cabecinhas fddfdca030 Start reifying error descriptions (Re-do of D23672 supporting VS2013)
Summary:
@kcc: I know you've accepted the other revision, but since this is a
non-trivial change, I'm updating it to show why D24029 would help.

This commit sets up the infrastructure to use reified error
descriptions, and moves ReportStackOverflow to the new system.

After we convert all the errors, we'll be able to simplify ScopedInErrorReport
and remove the older debugging mechanism which had some errors partly reified
in some way. We'll be able to maintain the external API.

ScopedInErrorReport will be able to track one of the reified errors at a time.
The purpose of this is so we have its destructor actually print the error and
possibly interface with the debugger (will depend on the platform, of course).

Reviewers: kcc, samsonov, timurrrr

Subscribers: kcc, llvm-commits, kubabrecka

Differential Revision: https://reviews.llvm.org/D24030

llvm-svn: 280111
2016-08-30 17:08:55 +00:00
Filipe Cabecinhas e0e18917b3 Split ScarinessScore between its "storage" (POD), and an initializing object.
Summary:
This is needed so we can use it for D23672 on VS2013, since this VS
version doesn't support unrestricted unions, and doesn't allow us to
uses an object without a trivial default constructor inside a union.

Reviewers: kcc, samsonov

Subscribers: kubabrecka, llvm-commits

Differential Revision: https://reviews.llvm.org/D24029

llvm-svn: 280110
2016-08-30 17:08:47 +00:00