summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/lsan
Commit message (Collapse)AuthorAgeFilesLines
...
* [sanitizer] Replace InternalScopedBuffer with InternalMmapVectorVitaly Buka2018-05-071-1/+1
| | | | llvm-svn: 331618
* [sanitizer] Remove reserving constructor from InternalMmapVectorVitaly Buka2018-05-073-7/+7
| | | | llvm-svn: 331617
* [sanitizer] Make InternalScopedBuffer::size() behavior similar to vector.Vitaly Buka2018-05-071-1/+2
| | | | llvm-svn: 331612
* [sanitizer] Split Symbolizer/StackTraces from core RTSanitizerCommonKostya Kortchinsky2018-04-161-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Host symbolizer & stacktraces related code in their own RT: `RTSanitizerCommonSymbolizer`, which is "libcdep" by nature. Symbolizer & stacktraces specific code that used to live in common files is moved to a new file `sanitizer_symbolizer_report.cc` as is. The purpose of this is the enforce a separation between code that relies on symbolization and code that doesn't. This saves the inclusion of spurious code due to the interface functions with default visibility, and the extra data associated. The following sanitizers makefiles were modified & tested locally: - dfsan: doesn't require the new symbolizer RT - esan: requires it - hwasan: requires it - lsan: requires it - msan: requires it - safestack: doesn't require it - xray: doesn't require it - tsan: requires it - ubsan: requires it - ubsan_minimal: doesn't require it - scudo: requires it (but not for Fuchsia that has a minimal runtime) This was tested locally on Linux, Android, Fuchsia. Reviewers: alekseyshl, eugenis, dberris, kubamracek, vitalybuka, dvyukov, mcgrathr Reviewed By: alekseyshl, vitalybuka Subscribers: srhines, kubamracek, mgorny, krytarowski, delcypher, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D45457 llvm-svn: 330131
* [sanitizer] Split coverage into separate RT in sanitizer_commonKostya Kortchinsky2018-03-221-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: `sanitizer_common`'s coverage support is fairly well separated, and libcdep by default. Several sanitizers don't make use of coverage, and as far as I can tell do no benefit from the extra dependencies pulled in by the coverage public interface functions. The following sanitizers call `InitializeCoverage` explicitely: MSan, ASan, LSan, HWAsan, UBSan. On top of this, any sanitizer bundling RTUBSan should add the coverage RT as well: ASan, Scudo, UBSan, CFI (diag), TSan, MSan, HWAsan. So in the end the following have no need: DFSan, ESan, CFI, SafeStack (nolibc anyway), XRay, and the upcoming Scudo minimal runtime. I tested this with all the sanitizers check-* with gcc & clang, and in standalone on Linux & Android, and there was no issue. I couldn't test this on Mac, Fuchsia, BSDs, & Windows for lack of an environment, so adding a bunch of people for additional scrunity. I couldn't test HWAsan either. Reviewers: eugenis, vitalybuka, alekseyshl, flowerhack, kubamracek, dberris, rnk, krytarowski Reviewed By: vitalybuka, alekseyshl, flowerhack, dberris Subscribers: mgorny, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44701 llvm-svn: 328204
* [Sanitizers] Add more standard compliant posix_memalign implementation for LSan.Alex Shlyapnikov2018-03-124-3/+21
| | | | | | | | | | | | | | | Summary: Add more standard compliant posix_memalign implementation for LSan and use corresponding sanitizer's posix_memalign implenetations in allocation wrappers on Mac. Reviewers: eugenis, fjricci Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D44335 llvm-svn: 327338
* [lsan] Respect log_path option in standalone LSanMaxim Ostapenko2018-01-221-0/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D42303 llvm-svn: 323083
* [Sanitizers] Make common allocator agnostic to failure handling modes.Alex Shlyapnikov2018-01-171-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Make common allocator agnostic to failure handling modes and move the decision up to the particular sanitizer's allocator, where the context is available (call stack, parameters, return nullptr/crash mode etc.) It simplifies the common allocator and allows the particular sanitizer's allocator to generate more specific and detailed error reports (which will be implemented later). The behavior is largely the same, except one case, the violation of the common allocator's check for "size + alignment" overflow is now reportied as OOM instead of "bad request". It feels like a worthy tradeoff and "size + alignment" is huge in this case anyway (thus, can be interpreted as not enough memory to satisfy the request). There's also a Report() statement added there. Reviewers: eugenis Subscribers: kubamracek, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D42198 llvm-svn: 322784
* [Sanitizers, LSan, Darwin] Allow for lack of VM_MEMORY_OS_ALLOC_ONCEFrancis Ricci2018-01-131-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Some time ago, the sanitizers as of r315899 were imported into gcc mainline. This broke bootstrap on Darwin 10 and 11, as reported in GCC PR sanitizer/82824 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82824) due to the unconditional use of VM_MEMORY_OS_ALLOC_ONCE. This was only introduced in Darwin 13/Mac OS X 10.9. The use of the macro was introduced in r300450. I couldn't find any statement which Darwin versions are supposed to be supported by LLVM, but the trivial patch to use the macro only if present allowed the gcc bootstrap to finish. So far, I haven't tried building llvm/compiler-rt on Darwin 11. Maybe the patch is simple enough to go in nonetheless. Committing on behalf of ro. Reviewers: glider, fjricci, kcc, kuba, kubamracek, george.karpenkov Reviewed By: fjricci Subscribers: #sanitizers, zaks.anna, srhines, dberris, kubamracek, llvm-commits Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D39888 llvm-svn: 322437
* Detect thread termination in LSan/NetBSDKamil Rytarowski2017-11-261-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Stop using the Linux solution with pthread_key_create(3). This approach does not work on NetBSD, because calling the thread destructor is not the latest operation on a POSIX thread entity. Detect _lwp_exit(2) call as it is really the latest operation called from a detaching POSIX thread. The pthread_key_create(3) solution also cannot be used in early libc/libpthread initialization on NetBSD as the system libraries are not bootstrapped enough. Sponsored by <The NetBSD Foundation> Reviewers: joerg, vitalybuka, kcc, dvyukov Reviewed By: dvyukov Subscribers: llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D40457 llvm-svn: 318994
* [LSan] Export __lsan_initAlex Shlyapnikov2017-11-151-1/+1
| | | | | | | | | | | | | | | | | | | Summary: lsan_preinit.cc is meant to be linked into executable and calls lsan_init from .preinit_array section. But if liblsan is a shared library, then this doesn't work, because the symbol is not exported. This patch fixes that. The counterparts like asan_init or __tsan_init already do have SANITIZER_INTERFACE_ATTRIBUTE. Committing on behalf of jakubjelinek. Reviewers: alekseyshl, kcc Subscribers: llvm-commits Differential revision: https://reviews.llvm.org/D39889 llvm-svn: 318349
* Fix some typos in a comment.Francis Ricci2017-11-151-3/+3
| | | | llvm-svn: 318336
* [lsan] Remove semicolon after do {} while (0)Tom de Vries2017-11-131-2/+2
| | | | | | | | Remove semicolon after "do {} while (0)" in LOG_POINTERS and LOG_THREADS. Reviewed by: kcc llvm-svn: 318085
* [sanitizers] Rename GetStackTraceWithPcBpAndContextVitaly Buka2017-11-092-10/+7
| | | | | | Name does not need to enumerate arguments. llvm-svn: 317774
* [lsan] Add "static" to internal functionVitaly Buka2017-11-091-1/+1
| | | | llvm-svn: 317772
* [LSan] Detect dynamic loader by its base address.Alex Shlyapnikov2017-11-062-8/+17
| | | | | | | | | | | | | | | | | | | | | Summary: Relanding D38600, which was reverted due to various PPC bot failures. If it breaks something again, please provide some pointers to broken bots, not just revert it, otherwise it's very hard to reason what's wrong with this commit. Whenever possible (Linux + glibc 2.16+), detect dynamic loader module by its base address, not by the module name matching. The current name matching approach fails on some configurations. Reviewers: eugenis Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D39275 llvm-svn: 317512
* [LSan] Adjust LSan allocator limits for PPC64.Alex Shlyapnikov2017-10-261-2/+9
| | | | | | | | | | | | Summary: Now the limits are the same as for ASan allocator. Reviewers: cryptoad Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D39309 llvm-svn: 316633
* Revert "[LSan] Detect dynamic loader by its base address."Alex Shlyapnikov2017-10-052-20/+8
| | | | | | | | This reverts commit r315024. Breaks sysconf_interceptor_bypass_test.cc llvm-svn: 315031
* [LSan] Detect dynamic loader by its base address.Alex Shlyapnikov2017-10-052-8/+20
| | | | | | | | | | | | | | | | | | | | | | Summary: Relanding D33859, which was reverted because it has "broken LOTS of ARM/AArch64 bots for two days". If it breaks something again, please provide some pointers to broken bots, not just revert it, otherwise it's very hard to reason what's wrong with this commit. Whenever possible (Linux + glibc 2.16+), detect dynamic loader module by its base address, not by the module name matching. The current name matching approach fails on some configurations. Reviewers: eugenis Subscribers: aemerson, kubamracek, kristof.beyls, llvm-commits Differential Revision: https://reviews.llvm.org/D38600 llvm-svn: 315024
* [lsan] Add __lsan_default_optionsVitaly Buka2017-09-224-0/+17
| | | | | | For consistency with asan, msan, tsan and ubsan. llvm-svn: 314048
* [lsan] Deadly signal handler for lsanVitaly Buka2017-09-222-0/+18
| | | | | | | | | | | | Summary: Part of https://github.com/google/sanitizers/issues/637 Reviewers: eugenis, alekseyshl Subscribers: llvm-commits, dberris, kubamracek, krytarowski Differential Revision: https://reviews.llvm.org/D37608 llvm-svn: 314041
* [asan/lsan] Make LSan compliant with recovery mode when running on top of ASanMaxim Ostapenko2017-09-222-0/+4
| | | | | | | | | | | Don't overwrite exit code in LSan when running on top of ASan in recovery mode to avoid breakage of users code due to found leaks. Patch by Slava Barinov. Differential Revision: https://reviews.llvm.org/D38026 llvm-svn: 313966
* [lsan] Extract GetStackTraceWithPcBpAndContext similar to asan versionVitaly Buka2017-09-141-15/+25
| | | | llvm-svn: 313239
* [compiler-rt] Cleanup decoratorsVitaly Buka2017-09-111-3/+2
| | | | | | | | | | | | | | Summary: Removed redundant End*() methods which defined same way. Removed redundant Warning() methods. Reviewers: eugenis Subscribers: kubamracek, llvm-commits, dberris Differential Revision: https://reviews.llvm.org/D37549 llvm-svn: 312950
* Add NetBSD support in lsan_interceptors.ccKamil Rytarowski2017-08-301-0/+1
| | | | | | | | | | | | | | | | | | | Summary: NetBSD is a modern POSIX-like UNIX-like Operating System derived from 4.4BSD/386BSD. Sponsored by <The NetBSD Foundation> Reviewers: joerg, vitalybuka, kcc, dvyukov Reviewed By: kcc Subscribers: llvm-commits, #sanitizers Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D37307 llvm-svn: 312184
* Add C++17 aligned new/delete interceptors to standalone lsanFrancis Ricci2017-08-161-3/+46
| | | | | | | | | | | | Summary: Based on r282019. Reviewers: kcc, jakubjelinek, alekseyshl Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D36757 llvm-svn: 311030
* Support compiler-rt builtinsPetr Hosek2017-07-281-1/+4
| | | | | | | | | This change adds support for compiler-rt builtins as an alternative compiler runtime to libgcc. Differential Revision: https://reviews.llvm.org/D35165 llvm-svn: 309361
* Revert "[sanitizer] Support compiler-rt builtins"Petr Hosek2017-07-261-4/+1
| | | | | | This reverts commit fd63314d6770e0da62572a3fea2c41c4cc0fc58a. llvm-svn: 309083
* [sanitizer] Support compiler-rt builtinsPetr Hosek2017-07-251-1/+4
| | | | | | | | | This change adds support for compiler-rt builtins as an alternative compiler runtime to libgcc. Differential Revision: https://reviews.llvm.org/D35165 llvm-svn: 309060
* Only scan global sections containing data in LSan on darwinFrancis Ricci2017-07-251-0/+21
| | | | | | | | | | | | | | | | | | | | Summary: __DATA segments on Darwin contain a large number of separate sections, many of which cannot actually contain pointers, and contain const values or objc metadata. Not scanning sections which cannot contain pointers significantly improves performance. On a medium-sized (~4000 files) internal project, I saw a speedup of about 30% in standalone LSan's execution time (30% improvement in the time spent running LSan, not the total program time). Reviewers: kcc, kubamracek, alekseyshl Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D35432 llvm-svn: 308999
* Revert "Only scan global sections containing data in LSan on darwin"Francis Ricci2017-07-181-11/+4
| | | | | | This reverts commit 7e46d78d47832f03ce42adcf56417fbfd47cbaad. llvm-svn: 308394
* Don't call exit() from atexit handlers on DarwinFrancis Ricci2017-07-185-7/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Calling exit() from an atexit handler is undefined behavior. On Linux, it's unavoidable, since we cannot intercept exit (_exit isn't called if a user program uses return instead of exit()), and I haven't seen it cause issues regardless. However, on Darwin, I have a fairly complex internal test that hangs roughly once in every 300 runs after leak reporting finishes, which is resolved with this patch, and is presumably due to the undefined behavior (since the Die() is the only thing that happens after the end of leak reporting). In addition, this is the way TSan works as well, where an atexit handler+Die() is used on Linux, and an _exit() interceptor is used on Darwin. I'm not sure if it's intentionally structured that way in TSan, since TSan sets up the atexit handler and the _exit() interceptor on both platforms, but I have observed that on Darwin, only the _exit() interceptor is used, and on Linux the atexit handler is used. There is some additional related discussion here: https://reviews.llvm.org/D35085 Reviewers: alekseyshl, kubamracek Subscribers: eugenis, vsk, llvm-commits Differential Revision: https://reviews.llvm.org/D35513 llvm-svn: 308353
* [Sanitizers] ASan/MSan/LSan allocators set errno on failure.Alex Shlyapnikov2017-07-181-11/+6
| | | | | | | | | | | | | | | | | | | | | Summary: ASan/MSan/LSan allocators set errno on allocation failures according to malloc/calloc/etc. expected behavior. MSan allocator was refactored a bit to make its structure more similar with other allocators. Also switch Scudo allocator to the internal errno definitions. TSan allocator changes will follow. Reviewers: eugenis Subscribers: llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D35275 llvm-svn: 308344
* Only scan global sections containing data in LSan on darwinFrancis Ricci2017-07-171-4/+11
| | | | | | | | | | | | | | | | | | | | Summary: __DATA segments on Darwin contain a large number of separate sections, most of which cannot actually contain pointers, and contain const values or objc metadata. Only scanning sections which can contain pointers greatly improves performance. On a medium-sized (~4000 files) internal project, I saw a speedup of about 50% in standalone LSan's execution time (50% improvement in the time spent running LSan, not the total program time). Reviewers: kcc, kubamracek, alekseyshl Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D35432 llvm-svn: 308231
* [Sanitizers] LSan allocator set errno on failure.Alex Shlyapnikov2017-07-141-10/+24
| | | | | | | Set proper errno code on alloction failures and change valloc and memalign implementations to satisfy their man-specified requirements. llvm-svn: 308063
* Refactor MemoryMappingLayout::Next to use a single struct instead of output ↵Francis Ricci2017-07-113-9/+7
| | | | | | | | | | | | | | | | | | | | | | | | | parameters. NFC. Summary: This is the first in a series of patches to refactor sanitizer_procmaps to allow MachO section information to be exposed on darwin. In addition, grouping all segment information in a single struct is cleaner than passing it through a large set of output parameters, and avoids the need for annotations of NULL parameters for unneeded information. The filename string is optional and must be managed and supplied by the calling function. This is to allow the MemoryMappedSegment struct to be stored on the stack without causing overly large stack sizes. Reviewers: alekseyshl, kubamracek, glider Subscribers: emaste, llvm-commits Differential Revision: https://reviews.llvm.org/D35135 llvm-svn: 307688
* Add an #if SANITIZER_MAC and a comment to lsan_common's suppression for ↵Kuba Mracek2017-07-101-3/+5
| | | | | | "_os_trace". llvm-svn: 307567
* [lsan] Add _os_trace into LSan's suppression listKuba Mracek2017-07-101-1/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D35173 llvm-svn: 307548
* Reverting an accidentally landed change.Kuba Mracek2017-07-101-1/+0
| | | | llvm-svn: 307539
* [tsan] Add support for running TSan tests on iOS simulator and devicesKuba Mracek2017-07-101-0/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D35157 llvm-svn: 307537
* [LSan] Make LSan allocator allocator_may_return_null compliantAlex Shlyapnikov2017-06-302-16/+46
| | | | | | | | | | | | | | | | | | Summary: An attempt to reland D34786 (which caused bot failres on Mac), now with properly intercepted operators new() and delete(). LSan allocator used to always return nullptr on too big allocation requests (the definition of "too big" depends on platform and bitness), now it follows policy configured by allocator_may_return_null flag Reviewers: eugenis Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D34845 llvm-svn: 306845
* MergeAlex Shlyapnikov2017-06-292-2/+2
| | | | llvm-svn: 306748
* [Sanitizers] Rename CallocShouldReturnNullDueToOverflow to ↵Alex Shlyapnikov2017-06-291-1/+1
| | | | | | | | | | | | | | | | CheckForCallocOverflow Summary: Due to changes in semantics, CheckForCallocOverflow makes much more sense now. Reviewers: eugenis Subscribers: llvm-commits, kubamracek Differential Revision: https://reviews.llvm.org/D34799 llvm-svn: 306747
* Revert "[LSan] Make LSan allocator allocator_may_return_null compliant"Michael Zolotukhin2017-06-292-4/+3
| | | | | | | | This reverts commit r306624. The committed test failed on various bots (e.g. on green dragon). llvm-svn: 306644
* [LSan] Make LSan allocator allocator_may_return_null compliantAlex Shlyapnikov2017-06-292-3/+4
| | | | | | | | | | | | | | | Summary: LSan allocator used to always return nullptr on too big allocation requests (the definition of "too big" depends on platform and bitness), now it follows policy configured by allocator_may_return_null flag. Reviewers: eugenis Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D34786 llvm-svn: 306624
* [Sanitizers] Operator new() interceptors always die on allocation errorAlex Shlyapnikov2017-06-281-8/+15
| | | | | | | | | | | | | | | | | | | | | 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
* [Sanitizers] Move cached allocator_may_return_null flag to sanitizer_allocatorAlex Shlyapnikov2017-06-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add lsan interceptors for libdispatch functions on darwinFrancis Ricci2017-06-196-5/+199
| | | | | | | | | | | | | | | | | 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
* Revert "Add lsan interceptors for libdispatch functions on darwin"Francis Ricci2017-06-196-199/+5
| | | | | | This reverts r305695 llvm-svn: 305712
* Add lsan interceptors for libdispatch functions on darwinFrancis Ricci2017-06-196-5/+199
| | | | | | | | | | | | | | | 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. Reviewers: alekseyshl, kubamracek, glider, kcc Subscribers: mgorny, llvm-commits Differential Revision: https://reviews.llvm.org/D34247 llvm-svn: 305695
OpenPOWER on IntegriCloud