summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test/asan/TestCases/Linux
Commit message (Collapse)AuthorAgeFilesLines
...
* Replace wc -l with count.Rafael Espindola2017-03-311-5/+5
| | | | | | This is a far more common way in llvm of counting lines in tests. llvm-svn: 299231
* [asan] Move AsanCheckDynamicRTPrereqs check under flagMaxim Ostapenko2017-03-311-0/+2
| | | | | | | | | | The patch addresses https://github.com/google/sanitizers/issues/786. Currently AsanCheckDynamicRTPrereqs prevents dynamic ASan runtime from running in some important environments e.g. cowbuilder and fakeroot that may also work with interposition. Let's allow users to switch off the check given that they know what they do. Differential Revision: https://reviews.llvm.org/D31420 llvm-svn: 299188
* [asan] Support line numbers in StackVarDescrKuba Mracek2017-03-301-2/+2
| | | | | | | | When -fsanitize-address-use-after-scope is used, the instrumentation produces line numbers in stack frame descriptions. This patch make sure the ASan runtime supports this format (ParseFrameDescription needs to be able to parse "varname:line") and prepares lit tests to allow line numbers in ASan report output. Differential Revision: https://reviews.llvm.org/D31484 llvm-svn: 299043
* Revert r298174, r298173, r298169, r298159.Evgeniy Stepanov2017-03-204-52/+13
| | | | | | | | | | | Revert "Fix sanitizer tests with LLVM_TOOL_LLD_BUILD=OFF." Revert "[asan] Remove gc-sections test with bfd." Revert "[asan] Disable globals-gc test with ld.bfd." Revert "[asan] Fix dead stripping of globals on Linux (compiler-rt)" OOM in gold linker. llvm-svn: 298287
* [asan] Remove gc-sections test with bfd.Evgeniy Stepanov2017-03-181-20/+0
| | | | | | | | | It used to be XFAIL: *, but with the new implementation it passes in some cases and fails in other. There are similar tests for gold and lld that are not flaky, and a positive test for bfd that makes sure that were are not breaking existing functionality. llvm-svn: 298173
* [asan] Disable globals-gc test with ld.bfd.Evgeniy Stepanov2017-03-171-0/+1
| | | | | | Fails on clang-cmake-armv7-a15-full. llvm-svn: 298169
* [asan] Fix dead stripping of globals on Linux (compiler-rt)Evgeniy Stepanov2017-03-174-4/+62
| | | | | | | | Runtime support for the new instrumentation of globals based on !associated, and a bunch of tests. Differential Revision: https://reviews.llvm.org/D30120 llvm-svn: 298159
* [asan] add one more argument to __sanitizer_print_memory_profile, remove a ↵Kostya Serebryany2017-03-151-10/+16
| | | | | | redundant weak definition. llvm-svn: 297914
* [sanitizer] Add weak hooks for Windows.Marcos Pividori2017-02-081-0/+1
| | | | | | | | | | | | Add support for weak hooks on Windows, as we do on Linux and Darwin. As we use the macro: `SANITIZER_INTERFACE_WEAK_DEF()` it was not necessary to modify the header file: `sanitizer_common_interceptors.h`. After this diff, many tests were fixed for libFuzzer. Differential Revision: https://reviews.llvm.org/D29562 llvm-svn: 294409
* [asan] replace std::random_shuffle with std::shuffle in tests since ↵Kostya Serebryany2017-02-071-1/+3
| | | | | | std::random_shuffle is being deprecated in C++17; NFC llvm-svn: 294370
* [sanitizer] Fix interface tests when SANITIZER_CAN_USE_CXXABI is true.Marcos Pividori2017-01-311-0/+1
| | | | | | | | We ignore `__ubsan_handle_dynamic_type_cache_miss*` symbols when `SANITIZER_CAN_USE_CXXABI` is true. Because they are included in the library but they are not included in the interface lists. llvm-svn: 293711
* [sanitizer] Add list of symbols exported in sanitizers' interface.Marcos Pividori2017-01-311-54/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new auxiliary file to each sanitizer: sanitizer_interface.inc, listing all the functions exported, with the macros: INTERFACE_FUNCTION() and INTERFACE_WEAK_FUNCTION(). So, when we need to define or repeat a procedure for each function in the sanitizer's interface, we can define the macros and include that header. In particular, these files are needed for Windows, in the nexts commits. Also, this files could replace the existing files: weak_symbols.txt for Apple. Instead of reading weak_symbols.txt to get the list of weak symbols, we could read the file sanitizer_interface.inc and consider all the symbols included with the macro INTERFACE_WEAK_FUNCTION(Name). In this commit, I only include these files to the sanitizers that work on Windows. We could do the same for the rest of the sanitizers when needed. I updated tests for: Linux, Darwin and Windows. If a new function is exported but is not present in the interface list, the tests "interface_symbols_[darwin|windows|linux].c" fail. Also, I remove the comments: "/* OPTIONAL */" which are not required any more, because we use the macro: INTERFACE_WEAK_FUNCTION() for weak functions. Differential Revision: https://reviews.llvm.org/D29148 llvm-svn: 293682
* [asan] Fix tests for exported interfaces.Marcos Pividori2017-01-291-0/+1
| | | | | | | | Add "OPTIONAL" comment to declaration of weak function in the internal interface. This fix the tests `interface_symbols_linux.c` and `interface_symbols_darwin.c` which were failing after r293423. llvm-svn: 293442
* Whenever reasonable, merge ASAN quarantine batches to save memory.Alex Shlyapnikov2017-01-192-18/+76
| | | | | | | | | | | | | | | | Summary: There are cases when thread local quarantine drains almost empty quarantine batches into the global quarantine. The current approach leaves them almost empty, which might create a huge memory overhead (each batch is 4K/8K, depends on bitness). Reviewers: eugenis Subscribers: kubabrecka, llvm-commits Differential Revision: https://reviews.llvm.org/D28068 llvm-svn: 292525
* ASAN activate/deactive controls thread_local_quarantine_size_kb option.Alex Shlyapnikov2017-01-121-3/+6
| | | | | | | | | | | | | | | Summary: Bypass quarantine altogether when quarantine size is set ot zero. Also, relax atomic load/store of quarantine parameters, the release/acquire semantics is an overkill here. Reviewers: eugenis Subscribers: kubabrecka, llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D28586 llvm-svn: 291791
* Revert r291509, 291510 and 291511Diana Picus2017-01-101-6/+3
| | | | | | | | | | | | | | | | | | | | | | | Revert "ASAN activate/deactive controls thread_local_quarantine_size_kb option." Revert "Bypass quarantine when quarantine size is set ot zero." Revert "ASAN activate/deactive controls thread_local_quarantine_size_kb option." One of these commits broke some of the ARM / AArch64 buildbots: TEST 'AddressSanitizer-aarch64-linux :: TestCases/Posix/start-deactivated.cc' FAILED Command Output (stderr): -- /home/buildslave/buildslave/clang-cmake-aarch64-42vma/llvm/projects/compiler-rt/test/asan/TestCases/Posix/start-deactivated.cc:85:12: error: expected string not found in input // CHECK: WARNING: AddressSanitizer failed to allocate 0xfff{{.*}} bytes ^ <stdin>:1:1: note: scanning from here start-deactivated.cc.tmp: /home/buildslave/buildslave/clang-cmake-aarch64-42vma/llvm/projects/compiler-rt/test/asan/TestCases/Posix/start-deactivated.cc:40: void test_malloc_shadow(char *, size_t, bool): Assertion `(char *)__asan_region_is_poisoned(p - 1, sz + 1) == (expect_redzones ? p - 1 : nullptr)' failed. ^ <stdin>:2:1: note: possible intended match here Error: Aborted (core dumped) ^ llvm-svn: 291560
* ASAN activate/deactive controls thread_local_quarantine_size_kb option.Alex Shlyapnikov2017-01-091-3/+6
| | | | | | | | | | | | Summary: Also, bypass quarantine altogether when quarantine size is set ot zero. Reviewers: eugenis Subscribers: kubabrecka, llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D28480 llvm-svn: 291511
* Fix unit test broken by D27873.Evgeniy Stepanov2016-12-281-1/+1
| | | | | | | | | | | | | | | | Summary: Reduce RSS size treshold in the unit test to accomodate for the smaller ASAN quarantine size on Android (see D27873). Reviewers: eugenis Patch by Alex Shlyapnikov. Subscribers: danalbert, kubabrecka, llvm-commits Differential Revision: https://reviews.llvm.org/D28132 llvm-svn: 290643
* Expose thread local quarantine size as ASAN option.Evgeniy Stepanov2016-12-221-0/+40
| | | | | | | | | | | | | | Summary: Make thread local quarantine size an option so it can be turned off to save memory. Reviewers: eugenis Patch by Alex Shlyapnikov. Subscribers: kubabrecka, llvm-commits Differential Revision: https://reviews.llvm.org/D28027 llvm-svn: 290373
* Revert r289690 "[sanitizer] intercept bstring functions, patch by Kuang-che ↵Hans Wennborg2016-12-153-58/+0
| | | | | | | | Wu (https://reviews.llvm.org/D27659)" It breaks programs on Mac. See comments on the code review for details. llvm-svn: 289864
* [sanitizer] intercept bstring functions, patch by Kuang-che Wu ↵Kostya Serebryany2016-12-143-0/+58
| | | | | | (https://reviews.llvm.org/D27659) llvm-svn: 289690
* Replace "|&" with "2>&1 |" to support bash pre-4Evgeniy Stepanov2016-12-061-2/+2
| | | | | | | | | | | | | | Summary: Old bash release (3.2) on SLES11 chokes on new redirection shortcut. Patch by Brian Cain. Reviewers: eugenis Subscribers: llvm-commits, kubabrecka Differential Revision: https://reviews.llvm.org/D27443 llvm-svn: 288854
* Return memory to OS right after free (not in the async thread).Evgeniy Stepanov2016-11-291-2/+2
| | | | | | | | | | | | | | | | | | Summary: In order to avoid starting a separate thread to return unused memory to the system (the thread interferes with process startup on Android, Zygota waits for all threads to exit before fork, but this thread never exits), try to return it right after free. Reviewers: eugenis Subscribers: cryptoad, filcab, danalbert, kubabrecka, llvm-commits Patch by Aleksey Shlyapnikov. Differential Revision: https://reviews.llvm.org/D27003 llvm-svn: 288091
* [ARM|ASAN] Disabling more unstable ASAN testsRenato Golin2016-11-192-4/+2
| | | | | | | | | | | We're seeying these errors with GCC and Clang on different systems, while some other identical OSs on different boards fail. Like many other ASAN tests, there seem to be no easy way to investigate this other than someone familiar with the sanitizer code and the ARM libraries. At least, for now, we'll silence the bots. I'll create a bugzilla entry. llvm-svn: 287464
* [asan] Run pthread_create_from_constructor test on x86 targets.Maxim Ostapenko2016-10-281-1/+1
| | | | llvm-svn: 285389
* [asan] Disable pthread_create_from_constructor test on PowerPC64.Maxim Ostapenko2016-10-281-0/+1
| | | | llvm-svn: 285387
* [asan/lsan] Avoid possible deadlock in dynamic ASan runtime thread ↵Maxim Ostapenko2016-10-281-0/+48
| | | | | | | | | | | | | | | | | | | | initialization. There is possible deadlock in dynamic ASan runtime when we dlopen() shared lib which creates a thread at the global initialization stage. The scenario: 1) dlopen grabs a GI_pthread_mutex_lock in main thread. 2) main thread calls pthread_create, ASan intercepts it, calls real pthread_create and waits for the second thread to be "fully initialized". 3) Newly created thread tries to access a thread local disable_counter in LSan (to complete its "full initialization") and hangs in tls_get_addr_tail, because it also tries to acquire GI_pthread_mutex_lock. The issue is reproducible on relative recent Glibc versions e.g. 2.23. Differential Revision: https://reviews.llvm.org/D26028 llvm-svn: 285385
* [asan] When protect_shadow_gap=0, set up the shadow for the shadow gap. This ↵Kostya Serebryany2016-10-041-0/+37
| | | | | | is needed to support NVIDIA CUDA drivers. Unfortunately, I don't know how to test it properly with CUDA on a public build bot, so adding a test that emulates the CUDA behavior. llvm-svn: 283270
* [sancov] removing html report option test, the option doesn't exist anymoreMike Aizatsky2016-09-291-24/+0
| | | | llvm-svn: 282727
* Add build script for symbolizer which can be linked into instrumented process.Vitaly Buka2016-09-281-10/+14
| | | | | | | | | | Reviewers: eugenis Subscribers: llvm-commits, kubabrecka Differential Revision: https://reviews.llvm.org/D24974 llvm-svn: 282617
* [ASAN] Pass previous stack information through __sanitizer_finish_switch_fiberDmitry Vyukov2016-09-281-24/+50
| | | | | | | | | | | This patch extends __sanitizer_finish_switch_fiber method to optionally return previous stack base and size. This solves the problem of coroutines/fibers library not knowing the original stack context from which the library is used. It's incorrect to assume that such context is always the default stack of current thread (e.g. one such library may be used from a fiber/coroutine created by another library). Bulding a separate stack tracking mechanism would not only duplicate AsanThread, but also require each coroutines/fibers library to integrate with it. Author: Andrii Grynenko (andriigrynenko) Reviewed in: https://reviews.llvm.org/D24628 llvm-svn: 282582
* [asan] add heap_profile=1 to asan to periodically print the heap profile. So ↵Kostya Serebryany2016-09-141-0/+32
| | | | | | far this is a very basic heap-profile functionality llvm-svn: 281546
* [asan] alloc_dealloc_mismatch=0 by default on Android.Evgeniy Stepanov2016-09-131-2/+2
| | | | | | | All known (to me) Android deployments are disabling this flag anyway. The in-tree script (asan_device_setup) does that, too. llvm-svn: 281410
* [asan] Add missing include for rand()Jonas Hahnfeld2016-09-131-0/+1
| | | | llvm-svn: 281342
* [asan] Disable handle_abort in Android tests.Evgeniy Stepanov2016-09-091-0/+2
| | | | | | | | | | | | | The same thing is already done on Mac. handle_abort slows down tests significantly because it triggers tombstone collection on Android; also, it changes failed test outcome from "not-crash" to "crash" (as in "bin/not --crash"). This change adds handle_abort=0 to asan options on android (test only!), and also tweaks android_run.py to semi-correctly pass the crash/no-crash status to the caller. llvm-svn: 281075
* [asan] Since r280945 fixed the OS X abort() problem, merge ↵Filipe Cabecinhas2016-09-091-14/+0
| | | | | | | | | | | | | | scariness_score_test.cc and make it a general test. Summary: Merges back both scariness_score_test.cc files, since the Linux-specific version shouldn't be needed any more. Reviewers: kcc, eugenis, vitalybuka Subscribers: llvm-commits, kubabrecka Differential Revision: https://reviews.llvm.org/D24347 llvm-svn: 281048
* [asan] Move scariness_score_test.cc to a common subdirectoryFilipe Cabecinhas2016-09-021-183/+5
| | | | | | | | | | | | | | | 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
* [asan] restrict release_to_os_test.cc to x86_64Kostya Serebryany2016-08-271-1/+1
| | | | llvm-svn: 279898
* [asan] first attempt at releasing free-d memory back to the system using ↵Kostya Serebryany2016-08-261-0/+45
| | | | | | madvise. Requires quite some tuning. llvm-svn: 279887
* [mips] XFAIL the new mips64el compiler-rt tests that fail on clang-cmake-mipsel.Daniel Sanders2016-08-122-0/+6
| | | | | | | | | | | | | | The mips64el compiler-rt build has recently been enabled. XFAIL the failing tests to make the buildbot green again. The two asan tests require the integrated assembler. This will be fixed soon for Debian mips64el but not for any other mips64el targets since doing so requires triple-related issues to be fixed.. The msan tests are largely failing because caused by a kernel update (a patch has already been posted for this). I'm not sure why the dfsan test fails yet. llvm-svn: 278504
* [sanitizers] Make it possible to XFAIL on the effective target, not just the ↵Daniel Sanders2016-08-092-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | default. Summary: The triple is not the right thing to XFAIL on since LIT only sees the default triple and not the effective triple chosen by any -target option in the RUN directives. This discrepancy is shown in the table below: Default Triple | Options | XFAIL | LIT's expected result | Desired expectation =================+===================================+========+=======================+==================== mips-linux-gnu | -target mips-linux-gnu | | Pass | Pass mips-linux-gnu | -target mips64-linux-gnu -mabi=64 | | Pass | Pass mips-linux-gnu | -target mips-linux-gnu | mips | Fail | Fail mips-linux-gnu | -target mips64-linux-gnu -mabi=64 | mips | Fail | Fail/Pass* (debatable**) mips-linux-gnu | -target mips-linux-gnu | mips- | Fail | Fail mips-linux-gnu | -target mips64-linux-gnu -mabi=64 | mips- | Fail | Pass* mips-linux-gnu | -target mips-linux-gnu | mips64 | Pass | Pass mips-linux-gnu | -target mips64-linux-gnu -mabi=64 | mips64 | Pass | Fail* mips64-linux-gnu | -target mips-linux-gnu | | Pass | Pass mips64-linux-gnu | -target mips64-linux-gnu -mabi=64 | | Pass | Pass mips64-linux-gnu | -target mips-linux-gnu | mips | Fail | Fail* mips64-linux-gnu | -target mips64-linux-gnu -mabi=64 | mips | Fail | Fail/Pass (debatable**) mips64-linux-gnu | -target mips-linux-gnu | mips- | Pass | Fail* mips64-linux-gnu | -target mips64-linux-gnu -mabi=64 | mips- | Pass | Pass mips64-linux-gnu | -target mips-linux-gnu | mips64 | Fail | Pass* mips64-linux-gnu | -target mips64-linux-gnu -mabi=64 | mips64 | Fail | Fail x64_64-linux-gnu | -target i386-linux-gnu | | Pass | Pass x64_64-linux-gnu | -target x86_64-linux-gnu | | Pass | Pass x64_64-linux-gnu | -target i386-linux-gnu | i386 | Pass | Fail* x64_64-linux-gnu | -target x86_64-linux-gnu | i386 | Pass | Pass x64_64-linux-gnu | -target i386-linux-gnu | x86_64 | Fail | Pass x64_64-linux-gnu | -target x86_64-linux-gnu | x86_64 | Fail | Fail* * These all differ from LIT's current behaviour. ** People's expectations vary depending on whether they know that LIT does a substring match on the default triple or think it's an exact match on an architecture. This patch adds "target-is-${target_arch}" to the available features list and updates the mips XFAIL's to use them. XFAIL'ing on these features will correctly account for the target being tested. Making the table: Options | XFAIL | LIT's expected result ==================================+==================+====================== -target mips-linux-gnu | | Pass -target mips64-linux-gnu -mabi=64 | | Pass -target mips-linux-gnu | target-is-mips | Fail -target mips64-linux-gnu -mabi=64 | target-is-mips | Pass -target mips-linux-gnu | target-is-mips64 | Pass -target mips64-linux-gnu -mabi=64 | target-is-mips64 | Fail -target i386-linux-gnu | | Pass -target x86_64-linux-gnu | | Pass -target i386-linux-gnu | target-is-i386 | Fail -target x86_64-linux-gnu | target-is-i386 | Pass -target i386-linux-gnu | target-is-x86_64 | Pass -target x86_64-linux-gnu | target-is-x86_64 | Fail Reviewers: probinson Subscribers: probinson, kubabrecka, llvm-commits, samsonov Differential Revision: https://reviews.llvm.org/D22802 llvm-svn: 278116
* [asan] trying to fix the android botKostya Serebryany2016-07-201-1/+0
| | | | llvm-svn: 276134
* [asan] trying to fix the android botKostya Serebryany2016-07-191-5/+9
| | | | llvm-svn: 276031
* [asan] trying to fix the windows build Kostya Serebryany2016-07-151-0/+21
| | | | llvm-svn: 275644
* [asan] add primitives that allow coroutine implementationsDmitry Vyukov2016-06-211-0/+178
| | | | | | | | | | | | | | | | | This patch adds the __sanitizer_start_switch_fiber and __sanitizer_finish_switch_fiber methods inspired from what can be found here https://github.com/facebook/folly/commit/2ea64dd24946cbc9f3f4ac3f6c6b98a486c56e73 . These methods are needed when the compiled software needs to implement coroutines, fibers or the like. Without a way to annotate them, when the program jumps to a stack that is not the thread stack, __asan_handle_no_return shows a warning about that, and the fake stack mechanism may free fake frames that are still in use. Author: blastrock (Philippe Daouadi) Reviewed in http://reviews.llvm.org/D20913 llvm-svn: 273260
* Hide send/sendto/sendmsg interptors under a flag.Evgeniy Stepanov2016-06-201-0/+1
| | | | | | | A runtime flag to enable checking in send* interceptors. Checking is enabled by default. llvm-svn: 273174
* [msan] Intercept send/sendto/sendmsg.Evgeniy Stepanov2016-06-171-7/+18
| | | | | | send/sendmsg moved from tsan to sanitizer_common; sendto is new. llvm-svn: 272980
* [asan] make print_memory_profile_test more reliable by using large ↵Kostya Serebryany2016-06-071-6/+6
| | | | | | allocation sizes. Hoping to fix the llvm-clang-lld-x86_64-debian-fast bot llvm-svn: 272020
* Fix the test for printing the memory profile. This fuctionality is onlyChandler Carruth2016-06-041-1/+5
| | | | | | | | | | | available along side the leak checking, so use the REQUIRES for that. Also, use %run as other tests do when launching the built binary. This fixes check-asan for me on Linux and looks like it should fix the linux sanitizer bots as well. llvm-svn: 271785
* [asan] add an interface function __sanitizer_print_memory_profile (a basic ↵Kostya Serebryany2016-06-021-0/+25
| | | | | | memory profiler; asan/Linux-only for now) llvm-svn: 271463
OpenPOWER on IntegriCloud