Commit Graph

1204 Commits

Author SHA1 Message Date
Nico Weber e837847ec6 Change another test I missed in r365724
llvm-svn: 365725
2019-07-11 01:21:17 +00:00
Nico Weber da233838c9 clang-cl: Remove -O0 option
cl.exe doesn't understand it; there's /Od instead. See also the review
thread for r229575.

Update lots of compiler-rt tests to use -Od instead of -O0.
Ran `rg -l 'clang_cl.*O0' compiler-rt/test/ | xargs sed -i -c 's/-O0/-Od/'`

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

llvm-svn: 365724
2019-07-11 01:18:05 +00:00
Matthew G McGovern 4e636156ef [sanitizers][windows] FIX: Rtl-Heap Interception and tests
- Adds interceptors for Rtl[Allocate|Free|Size|ReAllocate]Heap
   - Adds unit tests for the new interceptors and expands HeapAlloc
     tests to demonstrate new functionality.
   Reviewed as D62927
   - adds fixes for ~win and x64 tests

> llvm-svn: 365381

llvm-svn: 365424
2019-07-09 01:55:11 +00:00
Matthew G McGovern 848a19e4eb [sanitizers][windows] Rtl-Heap Interception and tests
- Adds interceptors for Rtl[Allocate|Free|Size|ReAllocate]Heap
   - Adds unit tests for the new interceptors and expands HeapAlloc
     tests to demonstrate new functionality.
   Reviewed as D62927

llvm-svn: 365422
2019-07-09 01:47:08 +00:00
JF Bastien c5630ac641 Revert "[sanitizers][windows] Rtl-Heap Interception and tests"
Causes build failure on clang-ppc64be-linux-lnt:

compiler-rt/lib/asan/asan_malloc_win.cc:23:2: error: #error "Missing arch or unsupported platform for Windows."
 #error "Missing arch or unsupported platform for Windows."
  ^~~~~
compiler-rt/lib/asan/asan_malloc_win.cc:25:10: fatal error: heapapi.h: No such file or directory
 #include <heapapi.h>
          ^~~~~~~~~~~
compilation terminated.
[39/1151] Building CXX object projects/compiler-rt/lib/asan/CMakeFiles/RTAsan.powerpc64.dir/asan_debugging.cc.o
[40/1151] Building CXX object projects/compiler-rt/lib/asan/CMakeFiles/RTAsan.powerpc64.dir/asan_malloc_win.cc.o
FAILED: projects/compiler-rt/lib/asan/CMakeFiles/RTAsan.powerpc64.dir/asan_malloc_win.cc.o
/usr/bin/c++  -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iprojects/compiler-rt/lib/asan -Icompiler-rt/lib/asan -Iinclude -I/home/buildbots/ppc64be-clang-lnt-test/clang-ppc64be-lnt/llvm/include -Icompiler-rt/lib/asan/.. -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -fdiagnostics-color -ffunction-sections -fdata-sections -Wall -std=c++11 -Wno-unused-parameter -O2    -UNDEBUG  -m64 -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fvisibility=hidden -fno-lto -O3 -g -Wno-variadic-macros -Wno-non-virtual-dtor -fno-rtti -MD -MT projects/compiler-rt/lib/asan/CMakeFiles/RTAsan.powerpc64.dir/asan_malloc_win.cc.o -MF projects/compiler-rt/lib/asan/CMakeFiles/RTAsan.powerpc64.dir/asan_malloc_win.cc.o.d -o projects/compiler-rt/lib/asan/CMakeFiles/RTAsan.powerpc64.dir/asan_malloc_win.cc.o -c compiler-rt/lib/asan/asan_malloc_win.cc
compiler-rt/lib/asan/asan_malloc_win.cc:23:2: error: #error "Missing arch or unsupported platform for Windows."
 #error "Missing arch or unsupported platform for Windows."
  ^~~~~
compiler-rt/lib/asan/asan_malloc_win.cc:25:10: fatal error: heapapi.h: No such file or directory
 #include <heapapi.h>
          ^~~~~~~~~~~

llvm-svn: 365384
2019-07-08 20:21:09 +00:00
Matthew G McGovern c9fa99d066 [sanitizers][windows] Rtl-Heap Interception and tests
- Adds interceptors for Rtl[Allocate|Free|Size|ReAllocate]Heap
   - Adds unit tests for the new interceptors and expands HeapAlloc
     tests to demonstrate new functionality.
   Reviewed as D62927

llvm-svn: 365381
2019-07-08 19:58:50 +00:00
Reid Kleckner 8007ff1ab1 [compiler-rt] Rename lit.*.cfg.* -> lit.*.cfg.py.*
These lit configuration files are really Python source code. Using the
.py file extension helps editors and tools use the correct language
mode. LLVM and Clang already use this convention for lit configuration,
this change simply applies it to all of compiler-rt.

Reviewers: vitalybuka, dberris

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

llvm-svn: 364591
2019-06-27 20:56:04 +00:00
Rainer Orth e6474e682a [compiler-rt][test] Set shared_libasan_path in test/asan/lit.cfg on Solaris
While checking warnings from the Solaris buildbots, I noticed

  llvm-lit: /opt/llvm-buildbot/home/solaris11-amd64/clang-solaris11-amd64/llvm/projects/compiler-rt/test/asan/lit.cfg:119: warning: %shared_libasan substitution not set but dynamic ASan is available.

Fixed as follows.  Tested on x86_64-pc-solaris2.11.

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

llvm-svn: 364394
2019-06-26 08:19:57 +00:00
Reid Kleckner 08b2bd0f30 [asan] Quote the path to the Python exe in case it has spaces
These days, Python 3 installs itself into Program Files, so it often has
spaces. At first, I resisted this, and I reinstalled it globally into
C:/Python37, similar to the location used for Python 2.7. But then I
updated VS 2019, and it uninstalled my copy of Python and installed a
new one inside "C:/Program Files (x86)/Microsoft Visual Studio/". At
this point, I gave up and switched to using its built-in version of
Python. However, now these tests fail, and have to be made aware of the
possibility of spaces in paths. :(

llvm-svn: 364077
2019-06-21 16:54:58 +00:00
Hans Wennborg 2cf990fa27 Revert r363633 "[CMake] Fix the value of `config.target_cflags` for non-macOS Apple platforms. Attempt #2."
This caused Chromium's clang package to stop building, see comment on
https://reviews.llvm.org/D61242 for details.

> Summary:
> The main problem here is that `-*-version_min=` was not being passed to
> the compiler when building test cases. This can cause problems when
> testing on devices running older OSs because Clang would previously
> assume the minimum deployment target is the the latest OS in the SDK
> which could be much newer than what the device is running.
>
> Previously the generated value looked like this:
>
> `-arch arm64 -isysroot
> <path_to_xcode>/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk`
>
> With this change it now looks like:
>
> `-arch arm64 -stdlib=libc++ -miphoneos-version-min=8.0 -isysroot
> <path_to_xcode>/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk`
>
> This mirrors the setting of `config.target_cflags` on macOS.
>
> This change is made for ASan, LibFuzzer, TSan, and UBSan.
>
> To implement this a new `get_test_cflags_for_apple_platform()` function
> has been added that when given an Apple platform name and architecture
> returns a string containing the C compiler flags to use when building
> tests. This also calls a new helper function `is_valid_apple_platform()`
> that validates Apple platform names.
>
> This is the second attempt at landing the patch. The first attempt (r359305)
> had to be reverted (r359327) due to a buildbot failure. The problem was
> that calling `get_test_cflags_for_apple_platform()` can trigger a CMake
> error if the provided architecture is not supported by the current
> CMake configuration. Previously, this could be triggered by passing
> `-DCOMPILER_RT_ENABLE_IOS=OFF` to CMake. The root cause is that we were
> generating test configurations for a list of architectures without
> checking if the relevant Sanitizer actually supported that architecture.
> We now intersect the list of architectures for an Apple platform
> with `<SANITIZER>_SUPPORTED_ARCH` (where `<SANITIZER>` is a Sanitizer
> name) to iterate through the correct list of architectures.
>
> rdar://problem/50124489
>
> Reviewers: kubamracek, yln, vsk, juliehockett, phosek
>
> Subscribers: mgorny, javed.absar, kristof.beyls, #sanitizers, llvm-commits
>
> Tags: #llvm, #sanitizers
>
> Differential Revision: https://reviews.llvm.org/D61242

llvm-svn: 363779
2019-06-19 09:09:39 +00:00
Dan Liew 9216358c21 Disable recently added Darwin symbolization tests for iOS.
These tests won't necessarily work because the reported modules paths
from the device don't match what's on the host and so offline
symbolization fails.

llvm-svn: 363641
2019-06-18 01:38:03 +00:00
Dan Liew 745632c63a [NFC] Split `Darwin/asan-symbolize-partial-report-with-module-map.cc`.
Split `Darwin/asan-symbolize-partial-report-with-module-map.cc` into two
separate test cases due to them testing slightly different things.

llvm-svn: 363640
2019-06-18 01:38:02 +00:00
Dan Liew 3c9f66dccf [asan_symbolize] Teach `asan_symbolize.py` to symbolicate partially symbolicated ASan reports.
Summary:
The use case here is to be able symbolicate ASan reports that might be
partially symbolicated, in particular where the function name is known but no source
location is available. This can be caused by missing debug info. Previously we
would only try to symbolicate completely unsymbolicated reports.

The code currently contains an unfortunate quirk to handle a darwin
specific bug (rdar://problem/49784442) in the way partially symbolicated
reports are emitted when the source location is missing.

rdar://problem/49476995

Reviewers: kubamracek, yln, samsonov, dvyukov, vitalybuka

Subscribers: aprantl, #sanitizers, llvm-commits

Tags: #llvm, #sanitizers

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

llvm-svn: 363639
2019-06-18 01:21:16 +00:00
Dan Liew 964909e4a6 [CMake] Fix the value of `config.target_cflags` for non-macOS Apple platforms. Attempt #2.
Summary:
The main problem here is that `-*-version_min=` was not being passed to
the compiler when building test cases. This can cause problems when
testing on devices running older OSs because Clang would previously
assume the minimum deployment target is the the latest OS in the SDK
which could be much newer than what the device is running.

Previously the generated value looked like this:

`-arch arm64 -isysroot
<path_to_xcode>/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk`

With this change it now looks like:

`-arch arm64 -stdlib=libc++ -miphoneos-version-min=8.0 -isysroot
<path_to_xcode>/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk`

This mirrors the setting of `config.target_cflags` on macOS.

This change is made for ASan, LibFuzzer, TSan, and UBSan.

To implement this a new `get_test_cflags_for_apple_platform()` function
has been added that when given an Apple platform name and architecture
returns a string containing the C compiler flags to use when building
tests. This also calls a new helper function `is_valid_apple_platform()`
that validates Apple platform names.

This is the second attempt at landing the patch. The first attempt (r359305)
had to be reverted (r359327) due to a buildbot failure. The problem was
that calling `get_test_cflags_for_apple_platform()` can trigger a CMake
error if the provided architecture is not supported by the current
CMake configuration. Previously, this could be triggered by passing
`-DCOMPILER_RT_ENABLE_IOS=OFF` to CMake. The root cause is that we were
generating test configurations for a list of architectures without
checking if the relevant Sanitizer actually supported that architecture.
We now intersect the list of architectures for an Apple platform
with `<SANITIZER>_SUPPORTED_ARCH` (where `<SANITIZER>` is a Sanitizer
name) to iterate through the correct list of architectures.

rdar://problem/50124489

Reviewers: kubamracek, yln, vsk, juliehockett, phosek

Subscribers: mgorny, javed.absar, kristof.beyls, #sanitizers, llvm-commits

Tags: #llvm, #sanitizers

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

llvm-svn: 363633
2019-06-17 23:37:46 +00:00
Matthew G McGovern d62416dfcd [AddressSanitizer] [Windows] Fix HeapReAlloc and _recalloc bugs in asan_malloc_win.cc
HeapReAlloc should allow for 0 sized reallocations without freeing the memory block provided by the user.

_recalloc previously did not zero new memory after reallocation.
https://reviews.llvm.org/D61268

llvm-svn: 359498
2019-04-29 20:26:19 +00:00
Dan Liew 18bc872405 Revert "[CMake] Fix the value of `config.target_cflags` for non-macOS Apple"
This reverts commit 1bcdbd68616dc7f8debe126caafef7a7242a0e6b.

It's been reported that some bots are failing with this change with CMake
error like:

```
CMake Error at /b/s/w/ir/k/llvm-project/compiler-rt/cmake/config-ix.cmake:177 (message):
  Unsupported architecture: arm64
Call Stack (most recent call first):
  /b/s/w/ir/k/llvm-project/compiler-rt/cmake/config-ix.cmake:216 (get_target_flags_for_arch)
  /b/s/w/ir/k/llvm-project/compiler-rt/test/tsan/CMakeLists.txt:78 (get_test_cflags_for_apple_platform)
```

I'm reverting the patch now to unbreak builds. I will investigate properly when time permits.

rdar://problem/50124489

llvm-svn: 359327
2019-04-26 17:53:25 +00:00
Dan Liew 60f5df948b [asan_symbolize] Teach `asan_symbolize.py` to symbolicate using a module map
Summary:
The use case here is to be able get the UUIDs of the modules that need
to be symbolicated so that external plugins can see them. This
information can be extracted from ASan reports if the `print_module_map`
ASan option is enabled. Currently printing of the module map is only
implemented on Darwin and so this is effectively a Darwin only feature
right now.

The module map hooks into symbolization using the new plugin
infrastructure. A new hook in `AsanSymbolizerPlugInProxy` (and in
`AsanSymbolizerPlugIn`) is also provided to allow external plugins to hook
into the module look up process. This will allow external plugins to
look up modules with knowledge of their UUID.

The new plug-in is currently stored in the `asan_symbolize.py` script.
We could potentially move this into a separate file in the future (to
reduce clutter) if we can come up with a policy for where to search for
plugins that should always get loaded.

rdar://problem/49476995

Reviewers: kubamracek, yln, samsonov, dvyukov, vitalybuka

Subscribers: #sanitizers, llvm-commits

Tags: #llvm, #sanitizers

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

llvm-svn: 359322
2019-04-26 16:54:09 +00:00
Dan Liew 9f59704a5d [CMake] Fix the value of `config.target_cflags` for non-macOS Apple
platforms.

The main problem here is that `-*-version_min=` was not being passed to
the compiler when building test cases. This can cause problems when
testing on devices running older OSs because Clang would previously
assume the minimum deployment target is the the latest OS in the SDK
which could be much newer than what the device is running.

Previously the generated value looked like this:

`-arch arm64 -isysroot
<path_to_xcode>/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk`

With this change it now looks like:

`-arch arm64 -stdlib=libc++ -miphoneos-version-min=8.0 -isysroot
<path_to_xcode>/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk`

This mirrors the setting of `config.target_cflags` on macOS.

This change is made for ASan, LibFuzzer, TSan, and UBSan.

To implement this a new `get_test_cflags_for_apple_platform()` function
has been added that when given an Apple platform name and architecture
returns a string containing the C compiler flags to use when building
tests. This also calls a new helper function `is_valid_apple_platform()`
that validates Apple platform names.

rdar://problem/50124489

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

llvm-svn: 359305
2019-04-26 13:22:39 +00:00
Dan Liew 403d3187a7 [asan_symbolize] Add a simple plugin architecture
Summary:
This change adds a simple plugin architecture to `asan_symbolize.py`.
The motivation here is that sometimes it's necessary to perform extra
work to figure out where binaries with debug symbols can actually be
found. For example it might be the case that a remote service needs
to be queried for binaries and then copied to the local system.

This "extra work" can be extremely site-specific such that adding the
code directly into the `asan_symbolize.py` would just clutter the code
for a very niche use case. To avoid this, the `asan_symbolize.py` can
now load external code via a new `--plugins` command line option.

These plugins are loaded before main command line argument parsing so
that they can add their own command line options.

Right now the only hook into the behaviour of symbolization is the
`filter_binary_path()` function which assumes a very similar role
to the `binary_name_filter` function that was previously in the code.
We can add more hooks as necessary.

Code in the `asan_symbolize.py` script does not call plugin code
directly. Instead it uses a `AsanSymbolizerPlugInProxy` object.
This object

* Loads plugins from files.
* Manages the lifetime of the plugins.
* Provides an interface for calling into plugin functions and handles
  calling into multiple plugins.

To unify the way binary paths are filtered the old `sysroot_path_filter`
function (and associated code) has been turned into a simple plugin
(`SysRootFilterPlugIn`) that is always loaded. The plugin unloads
itself if the `-s` option is not present on the command line. Users
should not see any functional change relating to this command line
option.

Some simple tests are provided to illustrate what plugin code looks
like and also to check the functionality continues to work.

rdar://problem/49476995

Reviewers: kubamracek, yln, samsonov, dvyukov, vitalybuka

Subscribers: srhines, #sanitizers, llvm-commits

Tags: #llvm, #sanitizers

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

llvm-svn: 358657
2019-04-18 11:34:31 +00:00
Dan Liew 836da99af9 [asan_symbolize] Use proper logging infrastructure.
Summary:
The previous logging infrastructure had several problems:

* Debugging output was emitted to standard output which is also where
  the symbolized output would go. Interleaving these two separate
  bits of information makes inspecting the output difficult and could
  potentially break tests.

* Enabling debugging output requires modifying the script which is
  not very conveninent.

* When debugging it isn't immediately obvious where the output is
  coming from.

This patch uses the Python standard library logging infrastructure
which fixes all of the above problems. Logging is controlled using
two new options.

* `--log-level` - Sets the logging level, default is
`info`.
* `--log-dest` - Set the logging destination, default
is standard error.

Some simple test cases for the feature are included.

rdar://problem/49476995

Reviewers: kubamracek, yln, samsonov, dvyukov, vitalybuka

Subscribers: #sanitizers, llvm-commits

Tags: #llvm, #sanitizers

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

llvm-svn: 357951
2019-04-08 22:28:27 +00:00
Pavel Labath 19cad6f089 [Sanitizer] Make wcrtomb test posix-only
wcrtomb is not intercepted on windows, so this test fails there. It's
not clear to me why we do not intercept this function there (I'll look
into that separately), but for now this should at least make the windows
sanitizer bot green again (broken by r357889, when I added this test).

I also add "UNSUPPORTED: android" as this function is also not
intercepted there.

llvm-svn: 357892
2019-04-08 09:13:13 +00:00
Pavel Labath 618dcfcaa3 [Sanitizer] Fix a possible write to freed memory in the wcrtomb interceptor
Summary:
r357240 added an interceptor for wctomb, which uses a temporary local
buffer to make sure we don't write to unallocated memory. This patch
applies the same technique to wcrtomb, and adds some additional tests
for this function.

Reviewers: vitalybuka, eugenis

Subscribers: kubamracek, delcypher, llvm-commits, #sanitizers

Tags: #llvm, #sanitizers

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

llvm-svn: 357889
2019-04-08 08:39:50 +00:00
Dan Liew 5988d72243 Enable `asan/TestCases/Posix/start-deactivated.cc` test for iOS.
Summary:
To make this test pass it was necesary to change `iossim_run.py` to
propagate the `ASAN_ACTIVATION_OPTIONS` environment variable into the
testing environment.

rdar://problem/49114807

Reviewers: kubamracek, yln, serge-sans-paille

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

llvm-svn: 356701
2019-03-21 19:20:44 +00:00
Reid Kleckner ed350f73c1 [asan] Disable -Wfortify-source in intentional OOB tests
Needed after r356397

llvm-svn: 356426
2019-03-18 23:03:46 +00:00
Evgeniy Stepanov aedec3f684 Remove ASan asm instrumentation.
Summary: It is incomplete and has no users AFAIK.

Reviewers: pcc, vitalybuka

Subscribers: srhines, kubamracek, mgorny, krytarowski, eraman, hiraditya, jdoerfert, #sanitizers, llvm-commits, thakis

Tags: #sanitizers, #llvm

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

llvm-svn: 355870
2019-03-11 21:50:10 +00:00
Evgeniy Stepanov 8cee2e8539 [sanitizer] Intercept bzero.
Summary:
Intercept bzero and enable existing __bzero interceptor in Linux.
bzero is deprecated but still used occasionally.

Reviewers: vitalybuka

Subscribers: srhines, kubamracek, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

llvm-svn: 355347
2019-03-04 22:58:11 +00:00
Clement Courbet dd885eaf5f Reland "[compiler-rt] Intercept the bcmp() function."
Fix test issues on darwin: The REQUIRES for the test should be the same as the
guard for whether we intercept bcmp.

llvm-svn: 355204
2019-03-01 16:42:08 +00:00
Julian Lettner b79f1f2e2a [Sanitizer] lit test config: Respect existing parallelism_group
llvm-svn: 355128
2019-02-28 19:26:53 +00:00
Evgeniy Stepanov f46a52b536 [hwasan, asan] Intercept vfork.
Summary:
Intercept vfork on arm, aarch64, i386 and x86_64.

Reviewers: pcc, vitalybuka

Subscribers: kubamracek, mgorny, javed.absar, krytarowski, kristof.beyls, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

llvm-svn: 355030
2019-02-27 21:11:50 +00:00
Julian Lettner 6eef7d0524 [Darwin][NFC] Refactor throttling of 64bit sanitizer tests on Darwin
Underlying condition for throttling is "has large mmap'd regions" (i.e.,
shadow memory) and not sanitizers in general (e.g., UBSan does not need
to be throttled).

Rename parallelism group `darwin-64bit-sanitizer` to `shadow-memory` and
apply it unconditionally to all tests which require it. We can then have
all the Darwin throttling logic in one place in the commen lit config.

Throttle sanitizer_common unit tests. Configuration was previously
missing from sanitizer_common/Unit/lit.site.cfg.

Reviewed by: kubamracek

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

llvm-svn: 355018
2019-02-27 19:06:20 +00:00
Vlad Tsyrklevich 443e00a51b Revert "[compiler-rt] Intercept the bcmp() function."
This reverts commits r354851, 354852, 354853 and r354888. They were
causing build failures on the android sanitizer bot.

llvm-svn: 354906
2019-02-26 18:28:15 +00:00
Clement Courbet ea7bd2f016 [compiler-rt] Disable failing test on darwin during investigation.
/Users/buildslave/jenkins/workspace/clang-stage1-configure-RA/llvm/projects/compiler-rt/test/asan/TestCases/Posix/bcmp_test.cc:14:12: error: CHECK: expected string not found in input
 // CHECK: {{#1.*bcmp}}
           ^
<stdin>:2:57: note: scanning from here
==34677==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffee93777c4 at pc 0x0001068a7285 bp 0x7ffee9377770 sp 0x7ffee9376ef8
                                                        ^
<stdin>:6:20: note: possible intended match here
 #2 0x106888e77 in main bcmp_test.cc:12
                   ^

llvm-svn: 354888
2019-02-26 15:25:04 +00:00
Clement Courbet e6f22596e5 [compiler-rt] disable asan bcmp tests on android.
Android does not have bcmp.

sanitizer-x86_64-linux-android: run instrumented asan tests [arm/aosp_marlin-userdebug/PI] -  stdio

llvm-svn: 354853
2019-02-26 09:16:51 +00:00
Clement Courbet 02b9b4e18d [compiler-rt] Intercept the bcmp() function.
Summary:
I have not introduced a separate hook for `bcmp()` as I don't think there
should be any reason for a sanitizer to treat it differently from `memcmp()`.

This is only enabled when building on POSIX with GNU extensions.

Context: this is to avoid losing coverage when emitting `bcmp() == 0` instead
of `memcmp() == 0` in llvm, see https://reviews.llvm.org/D56593.

Reviewers: mgorny, krytarowski, vitalybuka, dvyukov

Subscribers: kubamracek, dberris, delcypher, jdoerfert, #sanitizers, llvm-commits, jyknight

Tags: #llvm, #sanitizers

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

llvm-svn: 354851
2019-02-26 07:43:01 +00:00
Evgeniy Stepanov 7429228f20 [sanitizer] Re-disable a few tests on android.
Tests were accidentally enabled r354829.

llvm-svn: 354834
2019-02-26 00:22:22 +00:00
Evgeniy Stepanov f3b8c8509b [sanitizer] Remove "-android" from test_arch.
Summary:
ASan and Scudo tests are adding "-android" to test arch.
There are no tests that depend on it as far as I can see.
If necessary, do this instead:
  REQUIRES: aarch64-target-arch && android

Reviewers: pcc, vitalybuka

Subscribers: srhines, kubamracek, mgorny, javed.absar, kristof.beyls, cryptoad, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

llvm-svn: 354829
2019-02-25 22:32:30 +00:00
Evgeniy Stepanov 45eea20d2a Revert "[asan] Fix vfork handling.", +1
Revert r354625, r354627 - multiple build failures.

llvm-svn: 354629
2019-02-21 22:02:24 +00:00
Evgeniy Stepanov b5321d7d0b [asan] Fix vfork handling.
__asan_handle_vfork was unpoisoning the wrong part of the stack.
Adjust the test to catch this reliably (current failure is
non-deterministic).

llvm-svn: 354627
2019-02-21 21:55:06 +00:00
Evgeniy Stepanov df91386806 [hwasan,asan] Intercept vfork.
Summary: AArch64 only for now.

Reviewers: vitalybuka, pcc

Subscribers: srhines, kubamracek, mgorny, javed.absar, krytarowski, kristof.beyls, jdoerfert, #sanitizers, llvm-commits, kcc

Tags: #sanitizers, #llvm

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

llvm-svn: 354625
2019-02-21 21:32:24 +00:00
Julian Lettner 68c6764c20 [Sanitizer] iOS: Pull up parallelism_group handling into common.lit.config
Serial execution on iOS devices is not specific to sanitizers. We want
to throttle all on-device tests. Pull the setting of the
parallelism_group up into the common lit configuration file.

Rename `darwin-ios-device-sanitizer` to `ios-device`. This group is not
specific to sanitizers and (theoretically) independent from the host OS.

Note that we don't support running unit tests on-device (there are no
configurations generated for that). If that ever changes, we also need
this configuration in `unittests/lit.common.unit.cfg`.

Reviewers: delcypher

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

llvm-svn: 354179
2019-02-15 22:12:36 +00:00
Dan Liew cf34faa3e5 Explicitly set C++ standard for `Posix/no-fd.cc` ASan test.
Summary:
The test uses `nullptr` which can break running the test if the
compiler happens to be using something older than C++11 as the default
language standard. Avoid this by explicitly setting the standard.

rdar://problem/47253542

Reviewers: eugenis, yln, vitalybuka

Subscribers: kubamracek, #sanitizers, llvm-commits

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

llvm-svn: 351169
2019-01-15 08:54:10 +00:00
Diana Picus 2e3aaed7e7 [asan] Add fallback for Thumb after r350139
This reverts r350806 which marked some tests as UNSUPPORTED on ARM and
instead reintroduces the old code path only for Thumb, since that seems
to be the only target that broke.

It would still be nice to find the root cause of the breakage, but with
the branch point for LLVM 8.0 scheduled for next week it's better to put
things in a stable state while we investigate.

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

llvm-svn: 351040
2019-01-14 09:45:49 +00:00
Diana Picus decce55758 [asan] Mark tests as UNSUPPORTED on arm
Temporarily mark a couple of tests as UNSUPPORTED until we figure out
why they fail on the thumb bots.

The failure was introduced in
r350139 - Add support for background thread on NetBSD in ASan.

llvm-svn: 350806
2019-01-10 09:40:56 +00:00
David Carlier 5e53818be5 [asan] Disable TSD dtor leak unit tests on FreeBSD x86 64
- Assertion fails in the third iteration.

Reviewers: krytarowski

Reviewed By: krytarowski

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

llvm-svn: 350744
2019-01-09 17:14:57 +00:00
Evgeniy Stepanov e1caa4ac72 [asan] Support running without /proc
Summary:
This patch lets ASan run when /proc is not accessible (ex. not mounted
yet). It includes a special test-only flag that emulates this condition
in an unpriviledged process.

This only matters on Linux, where /proc is necessary to enumerate
virtual memory mappings.

Reviewers: vitalybuka, pcc, krytarowski

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 350590
2019-01-08 01:07:34 +00:00
Evgeniy Stepanov 3408b497f9 Revert "[asan] Support running without /proc.", +1
Revert r350104 "[asan] Fix build on windows."
Revert r350101 "[asan] Support running without /proc."

These changes break Mac build, too.

llvm-svn: 350112
2018-12-28 01:27:18 +00:00
Kamil Rytarowski 636269526d Enable asan_and_llvm_coverage_test.cc for NetBSD
LLVM profile is now enabled for this target.

llvm-svn: 350106
2018-12-27 22:55:13 +00:00
Evgeniy Stepanov d9df65fd0d [asan] Support running without /proc.
Summary:
This patch lets ASan run when /proc is not accessible (ex. not mounted
yet). It includes a special test-only flag that emulates this condition
in an unpriviledged process.

This only matters on Linux, where /proc is necessary to enumerate
virtual memory mappings.

Reviewers: pcc, vitalybuka

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 350101
2018-12-27 21:31:52 +00:00
Martin Liska 7240eb3ba9 Do not rely on that subject of ErrorAllocTypeMismatch is a heap address.
Differential Revision: https://reviews.llvm.org/D54856.

llvm-svn: 350085
2018-12-27 08:39:13 +00:00
Vitaly Buka cdecca0324 Revert "[asan] Disable test on powerpc64be"
Now the test is passing on that bot. Some incremental build issues?

This reverts commit e00b5a5229ae02088d9f32a4e328eaa08abaf354.

llvm-svn: 349852
2018-12-20 23:25:26 +00:00