summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_allocator_internal.h
AgeCommit message (Collapse)Author
2017-06-20[Sanitizers] Move cached allocator_may_return_null flag to sanitizer_allocatorAlex Shlyapnikov
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@305858 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-15[sanitizer] Change SizeClassAllocator32 to accept just one templateKostya Kortchinsky
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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@303071 91177308-0d34-0410-b5e6-96231b3b80d8
2016-09-15[compiler-rt] Do not introduce __sanitizer namespace globallyAnna Zaks
The definitions in sanitizer_common may conflict with definitions from system headers because: The runtime includes the system headers after the project headers (as per LLVM coding guidelines). lib/sanitizer_common/sanitizer_internal_defs.h pollutes the namespace of everything defined after it, which is all/most of the sanitizer .h and .cc files and the included system headers with: using namespace __sanitizer; // NOLINT This patch solves the problem by introducing the namespace only within the sanitizer namespaces as proposed by Dmitry. Differential Revision: https://reviews.llvm.org/D21947 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@281657 91177308-0d34-0410-b5e6-96231b3b80d8
2016-06-06[tsan] Switch to InternalAlloc everywhere __libc_malloc is currently usedKuba Brecka
This patch replaces all uses of __libc_malloc and friends with the internal allocator. It seems that the only reason why we have calls to __libc_malloc in the first place was the lack of the internal allocator at the time. Using the internal allocator will also make sure that the system allocator is never used (this is the same behavior as ASan), and we don’t have to worry about working with unknown pointers coming from the system allocator. Differential Revision: http://reviews.llvm.org/D21025 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@271916 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-29[sanitizer] Fix Clang-tidy modernize-use-nullptr warnings in ↵Kostya Serebryany
lib/sanitizer_common headers, unify closing inclusion guards. Patch by Eugene Zelenko git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@248816 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
2014-09-17tsan: fix crash when a program registers zillions of atexit callbacksDmitry Vyukov
I don't remember that crash on mmap in internal allocator ever yielded anything useful, only crashes in rare wierd untested situations. One of the reasons for crash was to catch if tsan starts allocating clocks using mmap. Tsan does not allocate clocks using internal_alloc anymore. Solve it once and for all by allowing mmaps. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@217929 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-26tsan: reduce internal allocator region from 16M to 1MDmitry Vyukov
16M regions can waste almost 1G for nothing. Since region size is used only during initial heap growth, it's unclear why we even need such huge regions. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@214027 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-26tsan: remove meta from internal allocatorDmitry Vyukov
I am puzzled why it is even there. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@214026 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-28tsan: add new line at the end of error messageDmitry Vyukov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@202470 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-26[asan] allow asan to use SizeClassAllocator32 on a 64-bit platform (if ↵Kostya Serebryany
SANITIZER_CAN_USE_ALLOCATOR64=0). No functionality change by default is intended git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@198044 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-25[sanitizer] Implement TwoLevelByteMap and use it for the internal allocator ↵Kostya Serebryany
on 64-bit. Summary: Implement TwoLevelByteMap and use it for the internal allocator on 64-bit. This reduces bss on 64-bit by ~8Mb because we don't use FlatByteMap on 64-bits any more. Dmitry, please check my understanding of atomics. Reviewers: dvyukov Reviewed By: dvyukov CC: samsonov, llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2259 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@195637 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-29[sanitizer] Use raw check in internal allocator to prevent self-deadlocks. ↵Alexey Samsonov
Try to fix Windows build. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@182840 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-29Exclude sanitizer_nolibc_test from TSan test run. Fix lint warningsAlexey Samsonov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@182837 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-29Make InternalAlloc/InternalFree in sanitizer runtimes libc-free by switching ↵Alexey Samsonov
to a custom allocator. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@182836 91177308-0d34-0410-b5e6-96231b3b80d8