summaryrefslogtreecommitdiff
path: root/lib/lsan/lsan_common.h
AgeCommit message (Collapse)Author
2016-01-16[LSan] Ignore all allocations made inside pthread_create.Alexey Samsonov
Thread stack/TLS may be stored by libpthread for future reuse after thread destruction, and the linked list it's stored in doesn't even hold valid pointers to the objects, the latter are calculated by obscure pointer arithmetic. With this change applied, LSan test suite passes with "use_ld_allocations" flag defaulted to "false". It still requires more testing to check if the default can be switched. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@257975 91177308-0d34-0410-b5e6-96231b3b80d8
2016-01-14[LSan] Use __tls_get_addr interceptor to keep track of dynamic TLS.Alexey Samsonov
Summary: We have a way to keep track of allocated DTLS segments: let's use it in LSan. Although this code is fragile and relies on glibc implementation details, in some cases it proves to be better than existing way of tracking DTLS in LSan: marking as "reachable" all memory chunks allocated directly by "ld". The plan is to eventually get rid of the latter, once we are sure it's safe to remove. Reviewers: kcc Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D16164 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@257785 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-21[lsan] [aarch64] Add support for AArch64Adhemerval Zanella
This patch add support for leak sanitizer for aarch64. Similar to MIPS it uses a SizeClassAllocator32 due VMA constraints (aarch64 currently supports 39 and 42-bit VMA). It also fixes the android build issue. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@250898 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-08Revert "[lsan] [aarch64] Add support for AArch64"Evgeniy Stepanov
This reverts commit ea02fa45225c35613bfecab383fb526e24b74497 (r249337). Reason: broken "ninja AsanUnitTests" on Android/AArch64. http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/20675/steps/build%20compiler-rt%20android%2Faarch64/logs/stdio git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@249730 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-05[lsan] [aarch64] Add support for AArch64Adhemerval Zanella
This patch add support for leak sanitizer for aarch64. Similar to MIPS it uses a SizeClassAllocator32 due VMA constraints (aarch64 currently supports 39 and 42-bit VMA). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@249337 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-26LSan: fix a deadlock caused by dl_iterate_phdr().Sergey Matveev
Wrap the StopTheWorld call in a dl_iterate_phdr() callback. This ensures that no other threads are holding the libdl lock, and we can safely reenter it in the tracer thread. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@230631 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-19[LSan] [MIPS] adding support of LSan for mips64/mips64el archMohit K. Bhakkad
Patch by Sagar Thakur Reviewers: petarj, earthdok, kcc. Subscribers: samsonov, dsanders, mohit.bhakkad, Anand.Takale, llvm-commits. Differential Revision: http://reviews.llvm.org/D7013 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@229830 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-17[LSan] Make parent tool responsible for initializing LSan flags.Alexey Samsonov
Summary: LSan can be combined with a parent tool (for now it's only ASan). Also, we allow LSAN_OPTIONS to override certain common flags. It means we have to parse LSAN_OPTIONS early enough, before the rest of the parent tool (including chunks of sanitizer_common) is initialized. In future, we can use the same approach for UBSan, after we embed it into ASan runtime in a similar way. Test Plan: regression test suite Reviewers: earthdok, eugenis Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D7577 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@229519 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-15[sanitizer] Flag parser rewrite.Evgeniy Stepanov
The new parser is a lot stricter about syntax, reports unrecognized flags, and will make it easier to implemented some of the planned features. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@226169 91177308-0d34-0410-b5e6-96231b3b80d8
2015-01-07[Sanitizer] Change the runtime flag representation.Alexey Samsonov
This mirrors r225239 to all the rest sanitizers: ASan, DFSan, LSan, MSan, TSan, UBSan. Now the runtime flag type, name, default value and description is located in the single place in the .inc file. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@225327 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-18[LSan] Parse common flags from LSAN_OPTIONS even if LSan is combined withAlexey Samsonov
another sanitizer. A user may run both LSan and LSan+ASan. It is weird to pass path to leak suppression file (or other common sanitizer flags, like "verbosity") in "LSAN_OPTIONS" in the first case and in "ASAN_OPTIONS" in the second case. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@215949 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-30[Sanitizer] Make "suppressions" and "print_suppressions" common runtime flags.Alexey Samsonov
No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@214343 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-21[lsan] disable lsan if wordsize is not 64Kostya Serebryany
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@209283 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-15[lsan] remove LeakSanitizerIsTurnedOffForTheCurrentProcess (this was a bad ↵Kostya Serebryany
idea), leave __lsan_is_turned_off git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@199304 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-10[lsan] handle 'new T[0]' where T is a type with DTOR; fixes ↵Kostya Serebryany
https://code.google.com/p/address-sanitizer/issues/detail?id=257 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@198932 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-10[lsan] rename __lsan_is_turned_off to ↵Kostya Serebryany
LeakSanitizerIsTurnedOffForTheCurrentProcess (leave the old variant for now for compatibility) git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@198921 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-24[lsan] Refactor the LeakReport class.Sergey Matveev
Those methods were too damn bloated. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@197978 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-24[lsan] Make the report_objects flag more useful.Sergey Matveev
Print the list of leaked objects after each leak report. Previously we printed only a joint list of all leaked objects. As a bonus, suppressed objects are no longer reported. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@197977 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-17[lsan] Remove the LSan-specific verbosity flag.Sergey Matveev
It conflicted with the verbosity flag we had in common flags. We don't need an LSan-specific flag anyway. Also, shift some logging levels and remove some unnecessary code. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@197512 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-17[lsan] Introduce print_suppressions flag.Sergey Matveev
Introduce a flag to either always or never print matched suppressions. Previously, matched suppressions were printed unconditionally if there were unsuppressed leaks. Also, verbosity=1 no longer has the semantics of "always print suppressions and summary". git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@197510 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-17[lsan] Introduce __lsan_(un)register_root_region().Sergey Matveev
Add an interface for telling LSan that a region of memory is to be treated as a source of live pointers. Useful for code which stores pointers in mapped memory. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@197489 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-09[lsan] Make LSan ignore memory poisoned by ASan.Sergey Matveev
Summary: No more (potenital) false negatives due to red zones or fake stack frames. Reviewers: kcc, samsonov Reviewed By: samsonov CC: llvm-commits, samsonov Differential Revision: http://llvm-reviews.chandlerc.com/D2359 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@196778 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-14[lsan] Support ASan's stack-use-after-return mode in LSan.Sergey Matveev
Treat the fake stack as live memory. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@192593 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-13Define SANITIZER_INTERFACE_ATTRIBUTE on Windows and fix all the places where ↵Timur Iskhodzhanov
SANITIZER_INTERFACE_ATTRIBUTE or SANITIZER_ATTRIBUTE_WEAK are used git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@188261 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-08[lsan] Handle fork() correctly.Sergey Matveev
Update the main thread's os_id on every pthread_create, and before initiating leak checking. This ensures that we have the correct os_id even if we have forked after Init(). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@185815 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-28[lsan] Add suppression support.Sergey Matveev
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@185152 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-27[LSan] Add the way to disable LSan at link timeAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@185066 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-24Revert to C-style callbacks for iteration over allocator chunks.Sergey Matveev
Also clean up LSan code, fix some comments and replace void* with uptr to bring down the number of reinterpret_casts. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@184700 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-21[asan] Move lsan_disabled out of thread context.Sergey Matveev
Fix for the case where disabler is used in pthread key destructor. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@184553 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-14[LSan] Use a typedef for frontier vectorAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@183973 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-14[Sanitizer] Rename InternalVector to InternalMmapVectorAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@183972 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-11[lsan] Harmonized some naming inconsistencies.Sergey Matveev
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@183748 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-06[lsan] Implement __lsan_ignore_object().Sergey Matveev
Leak annotation similar to HeapChecker's IgnoreObject(). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@183412 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-03[lsan] Add __lsan_disable() and __lsan_enable().Sergey Matveev
Objects allocated after a call to __lsan_disable() will be treated as live memory. Also add a ScopedDisabler. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@183099 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-27[lsan] Begin converting LSan tests to output tests.Sergey Matveev
In this CL all old tests are removed and one LIT test is added. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@182730 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-24[lsan] Prettify LSan reports and add a summary.Sergey Matveev
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@182646 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-24[lsan] Add exitcode flag. Kill the process if leaks are found.Sergey Matveev
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@182641 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-21[lsan] Change CMakeLists to build the common LSan module for ASan.Sergey Matveev
Also, define CAN_SANITIZE_LEAKS. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@182383 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-20[lsan] GetUserBegin() in LSan.Sergey Matveev
Separate the notions of user-visible chunk and allocator chunk, to facilitate ASan integration. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@182256 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-20[lsan] Common leak checking module.Sergey Matveev
Leak checking functionality which will be shared between LSan/ASan/MSan. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@182249 91177308-0d34-0410-b5e6-96231b3b80d8