summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/asan
Commit message (Collapse)AuthorAgeFilesLines
...
* [sanitizer] Fix a conflict between abort_on_error and handle_abort.Evgeniy Stepanov2016-09-071-0/+2
| | | | | | | | | 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
* [asan] Fix a crash in GetCurrentThread() before init.Evgeniy Stepanov2016-09-071-1/+1
| | | | | | | | | 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
* [compiler-rt] Allow sanitizers to be compiled for windows with clangFrancis Ricci2016-09-071-1/+9
| | | | | | | | | | | | | | 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
* [powerpc] Move #if to appease warnings-as-errors testsBill Seurer2016-09-071-3/+4
| | | | | | | Previous patch added a #if which caused a variable and function to be unused. llvm-svn: 280846
* [powerpc] Disable ManyThreadsWithStatsStressTest test for ppc64Bill Seurer2016-09-071-0/+4
| | | | | | | | 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
* [asan] Reify ErrorNewDeleteSizeMismatchFilipe Cabecinhas2016-09-075-23/+58
| | | | | | | | | | | | Summary: Keep reifying other errors. Reviewers: kcc, samsonov Subscribers: llvm-commits, kubabrecka Differential Revision: https://reviews.llvm.org/D23874 llvm-svn: 280812
* asan: allow __asan_{before,after}_dynamic_init without registered globalsDmitry Vyukov2016-09-051-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix dll_host.cc test after adding div and gep trace coverage pointsReid Kleckner2016-09-011-0/+3
| | | | llvm-svn: 280387
* Remove extra scariness.Clear() call.Filipe Cabecinhas2016-09-011-1/+0
| | | | llvm-svn: 280372
* Clear scariness score when initializing ErrorDoubleFreeFilipe Cabecinhas2016-09-011-0/+1
| | | | llvm-svn: 280363
* Fix the use of unitialized value while reporting double free in ASAN.Ivan Krasin2016-08-311-0/+1
| | | | | | | | | | | | | | | | 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
* Fix buildbot bug: Wasn't printing scariness for DoubleFreeFilipe Cabecinhas2016-08-311-0/+1
| | | | llvm-svn: 280213
* Reify ErrorDoubleFreeFilipe Cabecinhas2016-08-313-15/+45
| | | | | | | | | | | | Summary: Keep reifying other errors. Reviewers: kcc, samsonov Subscribers: llvm-commits, kubabrecka Differential Revision: https://reviews.llvm.org/D23717 llvm-svn: 280201
* Start reifying error descriptions (Re-do of D23672 supporting VS2013)Filipe Cabecinhas2016-08-304-12/+134
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* Split ScarinessScore between its "storage" (POD), and an initializing object.Filipe Cabecinhas2016-08-301-7/+14
| | | | | | | | | | | | | | | 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
* [asan] Remove runtime flag detect_stack_use_after_scopeVitaly Buka2016-08-297-40/+0
| | | | | | | | | | | | | | | Summary: We are going to use store instructions to poison some allocas. Runtime flag will require branching in instrumented code on every lifetime intrinsic. We'd like to avoid that. Reviewers: eugenis Subscribers: llvm-commits, kubabrecka Differential Revision: https://reviews.llvm.org/D23967 llvm-svn: 279981
* Revert "Start reifying error descriptions. Second try: Try to appease Visual ↵Filipe Cabecinhas2016-08-284-126/+12
| | | | | | | | | Studio." This reverts r279931. Will try it with the same Visual Studio version before committing again. llvm-svn: 279932
* Start reifying error descriptions. Second try: Try to appease Visual Studio.Filipe Cabecinhas2016-08-284-12/+126
| | | | | | | | | | | | | | | | | | | | | | Summary: 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: kubabrecka, llvm-commits Differential Revision: https://reviews.llvm.org/D23672 llvm-svn: 279931
* [asan] first attempt at releasing free-d memory back to the system using ↵Kostya Serebryany2016-08-263-2/+7
| | | | | | madvise. Requires quite some tuning. llvm-svn: 279887
* Revert "Start reifying error descriptions"Filipe Cabecinhas2016-08-264-130/+12
| | | | | | This reverts r279862 to investigate VS failures. llvm-svn: 279865
* [CMake] Connect Compiler-RT targets to LLVM Runtimes directoryChris Bieneman2016-08-261-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch builds on LLVM r279776. In this patch I've done some cleanup and abstracted three common steps runtime components have in their CMakeLists files, and added a fourth. The three steps I abstract are: (1) Add a top-level target (i.e asan, msan, ...) (2) Set the target properties for sorting files in IDE generators (3) Make the compiler-rt target depend on the top-level target The new step is to check if a command named "runtime_register_component" is defined, and to call it with the component name. The runtime_register_component command is defined in llvm/runtimes/CMakeLists.txt, and presently just adds the component to a list of sub-components, which later gets used to generate target mappings. With this patch a new workflow for runtimes builds is supported. The new workflow when building runtimes from the LLVM runtimes directory is: > cmake [...] > ninja runtimes-configure > ninja asan The "runtimes-configure" target builds all the dependencies for configuring the runtimes projects, and runs CMake on the runtimes projects. Running the runtimes CMake generates a list of targets to bind into the top-level CMake so subsequent build invocations will have access to some of Compiler-RT's targets through the top-level build. Note: This patch does exclude some top-level targets from compiler-rt libraries because they either don't install files (sanitizer_common), or don't have a cooresponding `check` target (stats). llvm-svn: 279863
* Start reifying error descriptionsFilipe Cabecinhas2016-08-264-12/+130
| | | | | | | | | | | | | | | | | | | | | | Summary: 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: kubabrecka, llvm-commits Differential Revision: https://reviews.llvm.org/D23672 llvm-svn: 279862
* [sanitizer] enable random shuffling the memory chunks inside the allocator, ↵Kostya Serebryany2016-08-261-0/+1
| | | | | | under a flag. Set this flag for the scudo allocator, add a test. llvm-svn: 279793
* [asan] remove unused kAsanHeapRightRedzoneMagic (NFC); part 2 (sorry)Kostya Serebryany2016-08-251-1/+0
| | | | llvm-svn: 279790
* [asan] remove unused kAsanHeapRightRedzoneMagic (NFC)Kostya Serebryany2016-08-252-4/+0
| | | | llvm-svn: 279789
* [asan] fix windows botKostya Serebryany2016-08-251-0/+1
| | | | llvm-svn: 279781
* [sanitizer] change SizeClassAllocator64 to accept just one template ↵Kostya Serebryany2016-08-251-2/+9
| | | | | | parameter instead of 5. First, this will make the mangled names shorter. Second, this will make adding more parameters simpler. llvm-svn: 279771
* [asan] minor fix in the asan memory profileKostya Serebryany2016-08-233-1/+5
| | | | llvm-svn: 279547
* [asan] Fix OOB_char on arm 32bitVitaly Buka2016-08-231-1/+1
| | | | | | | | | | | | | | | | Summary: This does not actually fixes the test. AddressSanitizer::OOB_char behavior is inconsistent but it somehow usually works. On arm it runs more iterations than expected. And adding a new test with AddressSanitizerInterface prefix, even empty, somehow breaks OOB_char test. So I will rename my test to make the bot green and will continue to investigate the test. Reviewers: krasin Subscribers: aemerson, rengolin, kubabrecka, llvm-commits, samparker Differential Revision: https://reviews.llvm.org/D23790 llvm-svn: 279501
* Cleanup: Move the *AddressDescription printing code to Print() members ↵Filipe Cabecinhas2016-08-193-108/+159
| | | | | | | | | | | | | | | | inside those structs. Summary: The Print() members might take optional access_size and bug_type parameters to still be able to provide the same information Reviewers: kcc, samsonov Subscribers: kubabrecka, llvm-commits Differential Revision: https://reviews.llvm.org/D23658 llvm-svn: 279237
* Add header guards to asan_descriptions.hFilipe Cabecinhas2016-08-181-0/+4
| | | | llvm-svn: 279062
* Convert AsanLocateAddress to Get*AddressInformation functions.Filipe Cabecinhas2016-08-181-40/+40
| | | | llvm-svn: 279046
* [asan] trying to fix the windows botKostya Serebryany2016-08-181-0/+4
| | | | llvm-svn: 279030
* [asan] Add __asan_set_shadow_*Vitaly Buka2016-08-186-0/+90
| | | | | | | | | | | | | | | | Summary: We are poisoning small allocas using store instruction from instrumented code. For larger allocas we'd like to insert function calls instead of multiple stores. PR27453 Reviewers: kcc, eugenis Subscribers: llvm-commits, kubabrecka Differential Revision: https://reviews.llvm.org/D23616 llvm-svn: 279019
* [asan] Remove "Stack partial redzone" from reportVitaly Buka2016-08-173-5/+0
| | | | | | | | | | | | Summary: This value is never used. Reviewers: kcc, eugenis Subscribers: llvm-commits, kubabrecka Differential Revision: https://reviews.llvm.org/D23631 llvm-svn: 279010
* Split DescribeAddressIfGlobal between a function that gets all the ↵Filipe Cabecinhas2016-08-176-109/+115
| | | | | | | | | | | | | | | | | | information, and one that prints it. Summary: Replacement for part of D23518 This deals with global variable addresses. (This commit is written on top of D23605, but can be applied by itself) Reviewers: kcc, samsonov Subscribers: kubabrecka, llvm-commits Differential Revision: https://reviews.llvm.org/D23607 llvm-svn: 278959
* Split DescribeAddressIfStack between a function that gets all the ↵Filipe Cabecinhas2016-08-174-109/+142
| | | | | | | | | | | | | | | | information, and one that prints it. Summary: Replacement for part of D23518 This deals with stack addresses. Reviewers: kcc, samsonov Subscribers: kubabrecka, llvm-commits Differential Revision: https://reviews.llvm.org/D23605 llvm-svn: 278958
* Deal with buildbot fallout from r278917: s/AllocType()/GetAllocType()/ (had ↵Filipe Cabecinhas2016-08-173-4/+4
| | | | | | the same name as the enum) llvm-svn: 278919
* Rename DescribeHeapAddress to DescribeAddressIfHeap and split it into a ↵Filipe Cabecinhas2016-08-176-77/+162
| | | | | | | | | | | | | | | | | function to get all the information about the address, and one to print it. Summary: Replacement for part of D23518 This deals with heap addresses, and renames DescribeHeapAddress. Requires D23520, which moves code around to make it accessible in asan_describers.cc (and still accessible in asan_report.cc if needed). Reviewers: kcc, samsonov Subscribers: kubabrecka, llvm-commits Differential Revision: https://reviews.llvm.org/D23569 llvm-svn: 278917
* Move the Decorator, ThreadNameWithParenthesis, and DescribeThread to ↵Filipe Cabecinhas2016-08-164-108/+110
| | | | | | | | | | | | | | | | asan_descriptions.{h,cc} Summary: Replacement for part of D23518 Code refactoring to allow us to move some more DescribeAddressIf* functions to work by getting the structured information, and then printing it. Reviewers: kcc, samsonov Subscribers: kubabrecka, llvm-commits Differential Revision: https://reviews.llvm.org/D23520 llvm-svn: 278820
* Split DescribeAddressIfShadow between a function that gets all the ↵Filipe Cabecinhas2016-08-156-23/+97
| | | | | | | | | | | | | | | | | information, and one that prints it. Summary: Replacement for part of D23518 This is the first patch to start reifying information about errors. It deals only with reifying shadow address-related information. It will allow us to generate structures with all the relevant information for a given error so a debugger can get to them or they can be included in a core dump. Reviewers: kcc, samsonov Subscribers: kubabrecka, llvm-commits Differential Revision: https://reviews.llvm.org/D23519 llvm-svn: 278718
* Fix two tests in Win64 ASanReid Kleckner2016-08-051-4/+15
| | | | | | | | | | | | | | | | | | | | | Go back to intercepting kernel32!RaiseException, and only go for ntdll!RtlRaiseException if that fails. Fixes throw_and_catch.cc test. Work around an issue in LLVM's win64 epilogues. We end up with an epilogue that looks like this, and it drives the Win64 unwinder crazy until stack overflow: call ill_cc!__asan_handle_no_return xor eax,eax add rsp,40h // epilogue starts pop rbp // CSR ud2 // Trap here ret // Ret? nop word ptr [rax+rax] sub rsp,28h // Next function Will file a PR soon. llvm-svn: 277874
* [sanitizers] trace buffer API to use user-allocated buffer.Mike Aizatsky2016-08-051-1/+2
| | | | | | | | Subscribers: kubabrecka Differential Revision: https://reviews.llvm.org/D23186 llvm-svn: 277858
* fix random typos [NFC]Etienne Bergeron2016-08-052-4/+4
| | | | llvm-svn: 277850
* Avoid re-entrancy between __sanitizer::Report, OutputDebugString, and ↵Reid Kleckner2016-08-041-2/+5
| | | | | | | | | | | | | RtlRaiseException Our Report implementation calls OutputDebugString, which calls RtlRaiseException, which can re-enter back into the ASan runtime and cause a hang. Don't treat this special debugger-only exception code as a noreturn event, since the stack won't really unwind all the way. llvm-svn: 277763
* [ASan] Report illegal instruction exceptions in ASanReid Kleckner2016-08-031-5/+33
| | | | | | | | | | | | | | | | | | | Summary: Respect the handle_sigill common flag and handle_segv flags while we're at it. We still handle signals/exceptions differently on Unix and Windows. The installation process is tricky on Windows, and difficult to push down into sanitizer_common without concerning it with the different static/dynamic CRT models on Windows. Reviewers: kcc, etienneb Subscribers: llvm-commits, kubabrecka Differential Revision: https://reviews.llvm.org/D23098 llvm-svn: 277621
* [compiler-rt] Fix CHECK coding style [NFC]Etienne Bergeron2016-08-033-8/+8
| | | | llvm-svn: 277604
* [asan] Intercept RtlRaiseException instead of kernel32!RaiseExceptionReid Kleckner2016-08-021-4/+7
| | | | | | | | | | | | | | | | | | | | Summary: On my install of Windows 10, RaiseException is a tail call to kernelbase!RaiseException. Obviously, we fail to intercept that. Instead, try hooking at the ntdll!RtlRaiseException layer. It is unlikely that this layer will contain control flow. Intercepting at this level requires adding a decoding for 'LEA ESP, [ESP + 0xXXXXXXXX]', which is a really obscure way to write 'SUB ESP, 0xXXXXXXXX' that avoids clobbering EFLAGS. Reviewers: etienneb Subscribers: llvm-commits, kubabrecka Differential Revision: https://reviews.llvm.org/D23046 llvm-svn: 277518
* fix comments typos [NFC]Etienne Bergeron2016-08-021-4/+4
| | | | llvm-svn: 277511
* [asan] Remove NtWaitForWorkViaWorkerFactory interceptorReid Kleckner2016-08-021-37/+0
| | | | | | | | | | | | | | | | Summary: On Windows 10, this gets called after TLS has been torn down from NTDLL, and we crash attempting to return fake_tsd. This interceptor isn't needed after r242948 anyway, so let's remove it. The ASan runtime can now tolerate unregistered threads calling __asan_handle_no_return. Reviewers: vitalybuka, etienneb Subscribers: kubabrecka, llvm-commits Differential Revision: https://reviews.llvm.org/D23044 llvm-svn: 277478
OpenPOWER on IntegriCloud