summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/asan
Commit message (Collapse)AuthorAgeFilesLines
...
* [asan] Fix -Winvalid-paste error with clang-clReid Kleckner2017-07-061-1/+1
| | | | | | | We don't need to paste tokens here. String literal concatenation works just fine here with MSVC and Clang. llvm-svn: 307321
* [asan] Remove check for stack sizeJonas Hahnfeld2017-07-051-1/+0
| | | | | | | | This has been introduced in r304598 and fails for increased stack sizes. Differential Revision: https://reviews.llvm.org/D34876 llvm-svn: 307127
* fix trivial typos in comments; NFCHiroshi Inoue2017-07-051-1/+1
| | | | llvm-svn: 307124
* MergeAlex Shlyapnikov2017-06-291-1/+1
| | | | llvm-svn: 306746
* Export the nothrow overload of operator newReid Kleckner2017-06-291-15/+19
| | | | | | | This missing export was causing allocator_returns_null.cc to fail on Windows with a dynamic ASan runtime. llvm-svn: 306707
* Fix WinASan after moving wcslen interceptor to sanitizer_commonReid Kleckner2017-06-291-0/+1
| | | | | | | | | | | Do this by removing SANITIZER_INTERCEPT_WCSLEN and intercept wcslen everywhere. Before this change, we were already intercepting wcslen on Windows, but the interceptor was in asan, not sanitizer_common. After this change, we stopped intercepting wcslen on Windows, which broke asan_dll_thunk.c, which attempts to thunk to __asan_wcslen in the ASan runtime. llvm-svn: 306706
* [Sanitizers] Operator new() interceptors always die on allocation errorAlex Shlyapnikov2017-06-282-20/+30
| | | | | | | | | | | | | | | | | | | | | Summary: Operator new interceptors behavior is now controlled by their nothrow property as well as by allocator_may_return_null flag value: - allocator_may_return_null=* + new() - die on allocation error - allocator_may_return_null=0 + new(nothrow) - die on allocation error - allocator_may_return_null=1 + new(nothrow) - return null Ideally new() should throw std::bad_alloc exception, but that is not trivial to achieve, hence TODO. Reviewers: eugenis Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D34731 llvm-svn: 306604
* [asan] Fix windows build.Evgeniy Stepanov2017-06-281-1/+0
| | | | llvm-svn: 306493
* [msan] Intercept wcscat, wcsncat.Evgeniy Stepanov2017-06-271-11/+0
| | | | | | | | | | | | | | Also move wcslen, wscnlen to common interceptors. Reviewers: vitalybuka Reviewed By: vitalybuka Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D34656 llvm-svn: 306482
* [asan] Add support for Android debug message.Evgeniy Stepanov2017-06-231-0/+8
| | | | | | Add ASan report to the "debug message" field in Android tombstones. llvm-svn: 306184
* [Sanitizers] Move cached allocator_may_return_null flag to sanitizer_allocatorAlex Shlyapnikov2017-06-201-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Move cached allocator_may_return_null flag to sanitizer_allocator.cc and provide API to consolidate and unify the behavior of all specific allocators. Make all sanitizers using CombinedAllocator to follow AllocatorReturnNullOrDieOnOOM() rules to behave the same way when OOM happens. When OOM happens, turn allocator_out_of_memory flag on regardless of allocator_may_return_null flag value (it used to not to be set when allocator_may_return_null == true). release_to_os_interval_ms and rss_limit_exceeded will likely be moved to sanitizer_allocator.cc too (later). Reviewers: eugenis Subscribers: srhines, kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D34310 llvm-svn: 305858
* [asan] Fix android setup script to overwrite the symlink.Evgeniy Stepanov2017-06-191-3/+3
| | | | | | | This fixes asan_device_setup failing to update an existing asan installation. llvm-svn: 305746
* Add lsan interceptors for libdispatch functions on darwinFrancis Ricci2017-06-191-0/+9
| | | | | | | | | | | | | | | | | Summary: This is required for standalone LSan to work with libdispatch worker threads, and is a slimmed down version of the functionality provided for ASan in asan_mac.cc. Re-commit of r305695 with use_stacks=0 to get around a racy lingering pointer. Reviewers: alekseyshl, kubamracek, glider, kcc Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D34247 llvm-svn: 305732
* [Sanitizer] Remove CombinedAllocator::Allocate's 'cleared' parameterAlex Shlyapnikov2017-06-161-5/+3
| | | | | | | | | | | | | | Summary: CombinedAllocator::Allocate cleared parameter is not used anywhere and seem to be obsolete. Reviewers: eugenis Subscribers: llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D34289 llvm-svn: 305590
* [ASan] Move rss_limit_is_exceeded_ flag to ASan.Alex Shlyapnikov2017-06-131-5/+16
| | | | | | | | | | | | | | Summary: Move the OOM decision based on RSS limits out of generic allocator to ASan allocator, where it makes more sense at the moment. Reviewers: eugenis Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D34180 llvm-svn: 305342
* [asan] Fix ASan internal failure in AllocateFromLocalPoolMaxim Ostapenko2017-06-091-8/+14
| | | | | | | | | | | | | | This patch addresses PR 33206. There might be a situation when dynamic ASan runtime initializes later than shared library which has malloc in static constructor (rtld doesn't provide an order of shared libs initialization). In this case ASan hasn't yet initialized interceptors, but already intercepts malloc. If malloc is too big to be handled by static local pool, ASan will die with error: Sanitizer CHECK failed: lib/asan/asan_malloc_linux.cc:40 ((allocated_for_dlsym)) < ((kDlsymAllocPoolSize)) (1036, 1024) Patch by Denis Khalikov. Differential Revision: https://reviews.llvm.org/D33784 llvm-svn: 305058
* Revert r304285, r304297.Evgeniy Stepanov2017-06-053-20/+3
| | | | | | | | | | | r304285 - [sanitizer] Avoid possible deadlock in child process after fork r304297 - [sanitizer] Trying to fix MAC buildbots after r304285 These changes create deadlock when Tcl calls pthread_create from a pthread_atfork child handler. More info in the original review at https://reviews.llvm.org/D33325 llvm-svn: 304735
* [asan] fix one more case where stack-use-after-return is not ↵Kostya Serebryany2017-06-021-4/+8
| | | | | | async-signal-safe (during thread startup). beef-up the test to give it a chance to catch regressions. Also relax the lint to make C++11 more usable. llvm-svn: 304598
* [sanitizer-coverage] nuke more stale codeKostya Serebryany2017-06-022-5/+0
| | | | llvm-svn: 304504
* [sanitizer-coverage] nuke more stale codeKostya Serebryany2017-06-021-3/+2
| | | | llvm-svn: 304503
* [asan] Add strndup/__strndup interceptors.Pierre Gousseau2017-06-012-0/+31
| | | | | | | | Recommit of r302781 with Vitaly Buka's fix for non zero terminated strings. Differential Revision: https://reviews.llvm.org/D31457 llvm-svn: 304399
* [sanitizer] Trying to fix MAC buildbots after r304285Maxim Ostapenko2017-05-311-4/+8
| | | | | | | It seems that on MAC allocator already locks on fork thus adding another ForceLock in fork interceptor will cause a deadlock. llvm-svn: 304297
* [sanitizer] Avoid possible deadlock in child process after forkMaxim Ostapenko2017-05-313-3/+16
| | | | | | | | | | | | | | This patch addresses https://github.com/google/sanitizers/issues/774. When we fork a multi-threaded process it's possible to deadlock if some thread acquired StackDepot or allocator internal lock just before fork. In this case the lock will never be released in child process causing deadlock on following memory alloc/dealloc routine. While calling alloc/dealloc routines after multi-threaded fork is not allowed, most of modern allocators (Glibc, tcmalloc, jemalloc) are actually fork safe. Let's do the same for sanitizers except TSan that has complex locking rules. Differential Revision: https://reviews.llvm.org/D33325 llvm-svn: 304285
* [asan] Enable back some ASan tests disabled on PowerPC.Alex Shlyapnikov2017-05-262-13/+0
| | | | | | | | | | | | | | Summary: D33521 addressed a memory ordering issue in BlockingMutex, which seems to be the cause of a flakiness of a few ASan tests on PowerPC. Reviewers: eugenis Subscribers: kubamracek, nemanjai, llvm-commits Differential Revision: https://reviews.llvm.org/D33569 llvm-svn: 303995
* [compiler-rt] Replace allow_user_segv_handler=0 with kHandleSignalExclusiveVitaly Buka2017-05-251-9/+3
| | | | | | | | | | | | | | Summary: allow_user_segv_handler had confusing name did not allow to control behavior for signals separately. Reviewers: eugenis, alekseyshl, kcc Subscribers: llvm-commits, dberris, kubamracek Differential Revision: https://reviews.llvm.org/D33371 llvm-svn: 303941
* [compiler-rt] Change default of allow_user_segv_handler to trueVitaly Buka2017-05-252-13/+13
| | | | | | | | | | Reviewers: eugenis Subscribers: srhines, kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D32443 llvm-svn: 303842
* Revert "[compiler-rt] Change default of allow_user_segv_handler to true"Vitaly Buka2017-05-242-13/+13
| | | | | | | | Breaks sanitizer-x86_64-linux-fuzzer bot. This reverts commit r303729. llvm-svn: 303795
* [compiler-rt] Change default of allow_user_segv_handler to trueVitaly Buka2017-05-242-13/+13
| | | | | | | | | | Reviewers: eugenis Subscribers: srhines, kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D32443 llvm-svn: 303729
* [asan] Remove allow_user_segv_handler on Windows.Vitaly Buka2017-05-241-1/+1
| | | | | | | | | | | | | | | | | Summary: This flags is not covered by tests on Windows and looks like it's implemented incorrectly. Switching its default breaks some tests. Taking into account that related handle_segv flag is not supported on Windows it's safer to remove it until we commit to support it. Reviewers: eugenis, zturner, rnk Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D33471 llvm-svn: 303728
* Revert "[compiler-rt] Change default of allow_user_segv_handler to true"Vitaly Buka2017-05-202-13/+13
| | | | | | | | Failed libFuzzer tests on Windows. This reverts commit r303476. llvm-svn: 303481
* [compiler-rt] Change default of allow_user_segv_handler to trueVitaly Buka2017-05-202-13/+13
| | | | | | | | | | Reviewers: eugenis Subscribers: srhines, kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D32443 llvm-svn: 303476
* Revert r302781 and subsequent attempts to disable part of it.Daniel Jasper2017-05-182-25/+0
| | | | | | | The Msan unit tests are still broken and by this point, I think we should start over. llvm-svn: 303339
* Include setjmp.h unconditionally in asan_test_utils.hHans Wennborg2017-05-171-1/+1
| | | | | | | | | | | | | | | | | It's used in asan_test.cc also on Windows, and my build was failing with: C:/src/llvm/projects/compiler-rt/lib/asan/tests/asan_test.cc:549:28: error: unknown type name 'jmp_buf' NOINLINE void LongJmpFunc1(jmp_buf buf) { ^ C:/src/llvm/projects/compiler-rt/lib/asan/tests/asan_test.cc:569:10: error: unknown type name 'jmp_buf' static jmp_buf buf; ^ I couldn't find what changed to make this not work anymore, but this should fix it. llvm-svn: 303273
* [sanitizer] Change SizeClassAllocator32 to accept just one templateKostya Kortchinsky2017-05-151-4/+11
| | | | | | | | | | | | | | | | | | | | | Summary: With rL279771, SizeClassAllocator64 was changed to accept only one template instead of 5, for the following reasons: "First, this will make the mangled names shorter. Second, this will make adding more parameters simpler". This patch mirrors that work for SizeClassAllocator32. This is in preparation for introducing the randomization of chunks in the 32-bit SizeClassAllocator in a later patch. Reviewers: kcc, alekseyshl, dvyukov Reviewed By: alekseyshl Subscribers: llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D33141 llvm-svn: 303071
* [asan] Recommit of r301904: Add strndup/__strndup interceptorsPierre Gousseau2017-05-112-0/+25
| | | | | | | | | Fix undeclared __interceptor_malloc in esan_interceptors.cc Fix undeclared strnlen on OSX Differential Revision: https://reviews.llvm.org/D31457 llvm-svn: 302781
* [ASAN] Add interceptor for __longjmp_chkPeter Wu2017-05-042-0/+16
| | | | | | | | | | | | | | | | | Summary: glibc on Linux calls __longjmp_chk instead of longjmp (or _longjmp) when _FORTIFY_SOURCE is defined. Ensure that an ASAN-instrumented program intercepts this function when a system library calls it, otherwise the stack might remain poisoned and result in CHECK failures and false positives. Fixes https://github.com/google/sanitizers/issues/721 Reviewed By: eugenis Differential Revision: https://reviews.llvm.org/D32408 llvm-svn: 302152
* Revert r301904 causing tsan test failure in x86_64-linux-autoconfPierre Gousseau2017-05-022-25/+0
| | | | llvm-svn: 301909
* [asan] Add strndup/__strndup interceptors if targeting linux.Pierre Gousseau2017-05-022-0/+25
| | | | | | Differential Revision: https://reviews.llvm.org/D31457 llvm-svn: 301904
* [asan] speed up small memcpy (> 32 but <= 64 bytes)Kostya Serebryany2017-05-011-0/+7
| | | | llvm-svn: 301837
* [asan] Fix dead stripping of globals on Linux (compiler-rt).Evgeniy Stepanov2017-04-273-0/+27
| | | | | | | Third attempt. See the description of the corresponding commit in LLVM for more details. llvm-svn: 301588
* Define a suppression for known leaks on pthread_exit call.Alex Shlyapnikov2017-04-201-6/+3
| | | | | | | | | | | | Summary: Refer to D32194 for the context. Reviewers: eugenis Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D32303 llvm-svn: 300886
* Turn symbolization on for ASan unit test.Alex Shlyapnikov2017-04-191-4/+15
| | | | | | | | | | | | | | | | | | | | | | Summary: On PowerPC and ARM (possibly, need to verify), couple tests involving pthread_exit fail due to leaks detected by LSan. pthread_exit tries to perform unwinding that leads to dlopen'ing libgcc_s.so. dlopen mallocs "libgcc_s.so" string which confuses LSan, it fails to realize that this allocation happens in dynamic linker and should be ignored. Symbolized leak report is required to define a suppression for this known problem. Reviewers: eugenis Subscribers: aemerson, rengolin, kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D32194 Turn symbolization on for PPC and Thumb only to do not slow down other platforms. llvm-svn: 300748
* [sanitizer] Introduce tid_t as a typedef for OS-provided thread IDsKuba Mracek2017-04-172-5/+5
| | | | | | | | We seem to assume that OS-provided thread IDs are either uptr or int, neither of which is true on Darwin. This introduces a tid_t type, which holds a OS-provided thread ID (gettid on Linux, pthread_threadid_np on Darwin, pthread_self on FreeBSD). Differential Revision: https://reviews.llvm.org/D31774 llvm-svn: 300473
* Fix memory leaks in address sanitizer darwin testsFrancis Ricci2017-04-121-0/+1
| | | | | | | | | | | | Summary: These leaks are detected by leak sanitizer for darwin. Reviewers: glider, kubamracek, kcc, alekseyshl Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D31978 llvm-svn: 300080
* Reapply "Enable LSan for arm Linux"Maxim Ostapenko2017-04-111-0/+8
| | | | | | This patch reapplies r299923 with typo fixed in BLX macros. llvm-svn: 299948
* Revert r299923, it doesn't build in bootstrap builds.Nico Weber2017-04-111-8/+0
| | | | | | | | | | | | | | | FAILED: lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.arm.dir/sanitizer_linux.cc.o lib/sanitizer_common/sanitizer_linux.cc:1340:24: error: invalid instruction BLX(ip) ^ lib/sanitizer_common/sanitizer_linux.cc:1313:19: note: expanded from macro 'BLX' # define BLX(R) "mov lr, pc; bx" #R "\n" ^ <inline asm>:6:13: note: instantiated into assembly here mov lr, pc; bxip ^~~~ llvm-svn: 299943
* [lsan] Enable LSan for arm LinuxMaxim Ostapenko2017-04-111-0/+8
| | | | | | | | This patch enables LSan for arm Linux. Differential Revision: https://reviews.llvm.org/D29586 llvm-svn: 299923
* Revert "[asan] Fix dead stripping of globals on Linux (compiler-rt)."Evgeniy Stepanov2017-04-103-27/+0
| | | | | | This reverts r299698, which caused a big increase in object file size. llvm-svn: 299881
* [Asan] Eliminate SHADOW_TO_MEM() macroIvan A. Kosarev2017-04-102-2/+4
| | | | | | Differential Revision: https://reviews.llvm.org/D31592 llvm-svn: 299867
* [asan] Fix dead stripping of globals on Linux (compiler-rt).Evgeniy Stepanov2017-04-063-0/+27
| | | | | | This is a re-land of r298173, r298169, r298159. llvm-svn: 299698
OpenPOWER on IntegriCloud