summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/asan/asan_allocator2.cc
Commit message (Collapse)AuthorAgeFilesLines
* Rename asan_allocator2.cc to asan_allocator.ccAlexey Samsonov2014-12-171-793/+0
| | | | llvm-svn: 224396
* [ASan] Introduce SetCanPoisonMemory() function.Alexey Samsonov2014-12-171-3/+3
| | | | | | | | | | SetCanPoisonMemory()/CanPoisonMemory() functions are now used instead of "poison_heap" flag to determine if ASan is allowed to poison the shadow memory. This allows to hot-patch this value in runtime (e.g. during ASan activation) without introducing a data race. llvm-svn: 224395
* [Sanitizer] Introduce Allocator::may_return_null bool flag.Alexey Samsonov2014-12-121-7/+8
| | | | | | | | | | | | | | | | | | | | Summary: Turn "allocator_may_return_null" common flag into an Allocator::may_return_null bool flag. We want to make sure that common flags are immutable after initialization. There are cases when we want to change this flag in the allocator at runtime: e.g. in unit tests and during ASan activation on Android. Test Plan: regression test suite, real-life applications Reviewers: kcc, eugenis Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D6623 llvm-svn: 224148
* Change StackDepot interface to use StackTrace more extensivelyAlexey Samsonov2014-10-261-2/+2
| | | | llvm-svn: 220637
* [Sanitizer] Make StackTrace a lightweight reference to array of PCs, andAlexey Samsonov2014-10-261-26/+27
| | | | | | | | | | | | | | | | | | | | | | introduce a BufferedStackTrace class, which owns this array. Summary: This change splits __sanitizer::StackTrace class into a lightweight __sanitizer::StackTrace, which doesn't own array of PCs, and BufferedStackTrace, which owns it. This would allow us to simplify the interface of StackDepot, and eventually merge __sanitizer::StackTrace with __tsan::StackTrace. Test Plan: regression test suite. Reviewers: kcc, dvyukov Reviewed By: dvyukov Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D5985 llvm-svn: 220635
* [Sanitizer] Kill deprecated allocator interfaces in ASan, MSan and TSan in ↵Alexey Samsonov2014-08-121-18/+0
| | | | | | | | favor of a unified interface in <sanitizer/allocator_interface.h>. llvm-svn: 215469
* [asan] rename new-delete-size-mismatch to new-delete-type-mismatch and make ↵Kostya Serebryany2014-07-301-1/+1
| | | | | | the report more verbose llvm-svn: 214299
* [asan] add a feature to detect new-delete-size-mismatch (when used with ↵Kostya Serebryany2014-07-301-21/+14
| | | | | | -Xclang -fsized-deallocation). Not yet on Mac. Also, remove some unused code. llvm-svn: 214296
* Generalize sanitizer allocator public interface.Alexey Samsonov2014-07-071-4/+23
| | | | | | | | | | | | | | Introduce new public header <sanitizer/allocator_interface.h> and a set of functions __sanitizer_get_ownership(), __sanitizer_malloc_hook() etc. that will eventually replace their tool-specific equivalents (__asan_get_ownership(), __msan_get_ownership() etc.). Tool-specific functions are now deprecated and implemented as stubs redirecting to __sanitizer_ versions (which are implemented differently in each tool). Replace all uses of __xsan_ versions with __sanitizer_ versions in unit and lit tests. llvm-svn: 212469
* [asan] use some LIKELY/UNLIKELYKostya Serebryany2014-05-141-1/+1
| | | | llvm-svn: 208776
* [asan] fix the alloctor code to not use opaque data structure, which was ↵Kostya Serebryany2014-04-151-53/+18
| | | | | | larger than needed. This was a leftover of the allocator1=>allocator2 migration; thanks Yuri Gribov for reminding llvm-svn: 206280
* [asan] don't use bool in public interface, make sure the interface headers ↵Kostya Serebryany2014-04-141-1/+1
| | | | | | are usable in plain C llvm-svn: 206160
* [ASan] Speed up stack trace unwinding for stacks of size 2.Alexey Samsonov2014-03-041-0/+1
| | | | | | | | | | | | | | | | Summary: We don't need to do any work in this case - just take the current PC and caller PC. Reviewers: eugenis, ygribov Reviewed By: eugenis CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2936 llvm-svn: 202845
* [asan] Reinitialize allocator quarantine on activation.Evgeniy Stepanov2014-02-031-0/+4
| | | | | | | This is covered by AddressSanitizer.UAF_* tests in asan_test with start_deactivated=1. llvm-svn: 200696
* [asan] use correct type when computing shadow address in allocator (caused ↵Kostya Serebryany2014-01-181-1/+1
| | | | | | SEGV when asan run-time is built with gcc 4.8.2 on 32-bit arch) llvm-svn: 199544
* [asan] Implement delayed activation of AddressSanitizerEvgeniy Stepanov2014-01-161-1/+11
| | | | | | | | | | | | This change adds ASAN_OPTIONS=start_deactivated=1 flag. When present, ASan will start in "deactivated" mode, with no heap poisoning, no quarantine, no stack trace gathering, and minimal redzones. All this features come back when __asan_init is called for the constructor of an instrumented library. The primary use case for this feature is Android. Code itself is not Android-specific, and this patch includes a Linux test for it. llvm-svn: 199377
* [lsan] handle 'new T[0]' where T is a type with DTOR; fixes ↵Kostya Serebryany2014-01-101-2/+6
| | | | | | https://code.google.com/p/address-sanitizer/issues/detail?id=257 llvm-svn: 198932
* [asan] Implement max_redzone runtime flag.Evgeniy Stepanov2014-01-091-1/+2
| | | | llvm-svn: 198873
* [asan] allow asan to use SizeClassAllocator32 on a 64-bit platform (if ↵Kostya Serebryany2013-12-261-11/+15
| | | | | | SANITIZER_CAN_USE_ALLOCATOR64=0). No functionality change by default is intended llvm-svn: 198044
* [asan] when a fake stack is being unmapped also flush the corresponding shadowKostya Serebryany2013-12-111-6/+1
| | | | llvm-svn: 197040
* [ASan] Do not rely on malloc context in allocator reports.Alexey Samsonov2013-11-131-4/+5
| | | | | | | | | | | Invoke a fatal stack trace unwinder when ASan prints allocator-relevant error reports (double-free, alloc-dealloc-mismatch, invalid-free). Thus we'll be able to print complete stack trace even if allocation/free stacks are not stored (malloc_context_size=0). Based on the patch by Yuri Gribov! llvm-svn: 194579
* [ASan] Kill use_stack_depot runtime flag and stack trace compression routines.Alexey Samsonov2013-11-011-22/+4
| | | | llvm-svn: 193868
* [asan] increase the max malloc size from 8Gb to 64GbKostya Serebryany2013-10-291-1/+1
| | | | llvm-svn: 193615
* [asan] Fix a deadlock between asan's allocator and lsanKostya Serebryany2013-10-171-9/+15
| | | | | | | | | | | | | | | | Summary: This fixes a deadlock which happens in lsan on a large memalign-allocated chunk that resides in lsan's root set. Reviewers: samsonov, earthdok Reviewed By: earthdok CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1957 llvm-svn: 192885
* [asan] introduce run-time flag 'poison_partial' Kostya Serebryany2013-10-161-1/+1
| | | | llvm-svn: 192793
* [ASan] Don't die with internal ASan error on large buffer overflowsAlexey Samsonov2013-10-141-3/+5
| | | | | | | | | | | | | | | | | | | | Summary: Out-of-bound access may touch not-yet allocated or already freed and recycled from quarantine chunks. We should treat this situation as a "free-range memory access" and avoid printing any data about that irrelevant chunk (which may be inconsistent). This should fix https://code.google.com/p/address-sanitizer/issues/detail?id=183 Reviewers: kcc Reviewed By: kcc CC: timurrrr, llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1893 llvm-svn: 192581
* [ASan] Don't add SANITIZER_INTERFACE_ATTRIBUTE for internal ASan functionsAlexey Samsonov2013-09-171-4/+0
| | | | llvm-svn: 190860
* [asan] make calloc crash instead of returning 0 on overflow (controlled by ↵Kostya Serebryany2013-09-061-1/+2
| | | | | | the allocator_may_return_null flag) llvm-svn: 190128
* [sanitizer] make the allocator crash instead of returning 0 on huge size ↵Kostya Serebryany2013-09-061-1/+1
| | | | | | (controlled by the allocator_may_return_null flag) llvm-svn: 190127
* Define SANITIZER_INTERFACE_ATTRIBUTE on Windows and fix all the places where ↵Timur Iskhodzhanov2013-08-131-2/+2
| | | | | | SANITIZER_INTERFACE_ATTRIBUTE or SANITIZER_ATTRIBUTE_WEAK are used llvm-svn: 188261
* Revert to C-style callbacks for iteration over allocator chunks.Sergey Matveev2013-06-241-20/+9
| | | | | | | Also clean up LSan code, fix some comments and replace void* with uptr to bring down the number of reinterpret_casts. llvm-svn: 184700
* [lsan] Try REALLY hard to fix Win build.Sergey Matveev2013-06-211-0/+2
| | | | llvm-svn: 184557
* [asan] Move lsan_disabled out of thread context.Sergey Matveev2013-06-211-28/+4
| | | | | | Fix for the case where disabler is used in pthread key destructor. llvm-svn: 184553
* [asan] Define LSan annotations as no-ops if leak detection is not supported.Sergey Matveev2013-06-201-0/+4
| | | | llvm-svn: 184422
* [ASan] Clear allocation magic value before recycling the chunk. This led to ↵Alexey Samsonov2013-06-201-0/+3
| | | | | | spurious crashes in LSan when it walked through reused chunks. Don't know how to create not-brittle test case for this. llvm-svn: 184404
* [lsan] Harmonized some naming inconsistencies.Sergey Matveev2013-06-111-3/+3
| | | | llvm-svn: 183748
* [asan] fix Android build (mark asan_malloc_usable_size as an interface function)Kostya Serebryany2013-06-101-0/+1
| | | | llvm-svn: 183651
* [asan] fix the bug with memalign and malloc_usable_size ↵Kostya Serebryany2013-06-101-36/+18
| | | | | | (http://code.google.com/p/address-sanitizer/issues/detail?id=193); also fix lint llvm-svn: 183647
* [lsan] Put SANITIZER_INTERFACE_ATTRIBUTE on LSan interface functions.Sergey Matveev2013-06-061-0/+2
| | | | llvm-svn: 183429
* [lsan] Implement __lsan_ignore_object().Sergey Matveev2013-06-061-0/+14
| | | | | | Leak annotation similar to HeapChecker's IgnoreObject(). llvm-svn: 183412
* [ASan] One more fix for realloc: check that reallocated chunk is valid ↵Alexey Samsonov2013-06-061-6/+12
| | | | | | before calling memcpy llvm-svn: 183390
* Call __asan_free_hook() before marking the chunk quarantinnedAlexey Samsonov2013-06-041-13/+5
| | | | | | | | | | | | | | | | | | | | | Summary: With this change, the user may safely call __asan_get_ownership() from malloc/free hooks and assume it would return "true". If there is a realloc/free race, free hook might be called twice, but I think it's acceptable, as it's a data race and would later be reported anyway. This change also fixes a bug when failing realloc incorrectly marked the original memory as "quarantinned". Reviewers: timurrrr, kcc, samsonov Reviewed By: samsonov CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D913 llvm-svn: 183220
* [asan] Fix invalid thread registry access when checking if LSan is disabled.Sergey Matveev2013-06-041-2/+4
| | | | llvm-svn: 183218
* [lsan] Add __lsan_disable() and __lsan_enable().Sergey Matveev2013-06-031-1/+20
| | | | | | | Objects allocated after a call to __lsan_disable() will be treated as live memory. Also add a ScopedDisabler. llvm-svn: 183099
* [lsan] Use the fast version of GetBlockBegin for leak checking in LSan and ASan.Sergey Matveev2013-05-311-10/+22
| | | | llvm-svn: 182994
* [lsan] Begin converting LSan tests to output tests.Sergey Matveev2013-05-271-1/+0
| | | | | | In this CL all old tests are removed and one LIT test is added. llvm-svn: 182730
* Revert r182465 and add lsan-common library to makefile-based buildAlexey Samsonov2013-05-221-1/+1
| | | | llvm-svn: 182470
* [ASan] Temporary remove leak checking from ASan, while we don't have ↵Alexey Samsonov2013-05-221-2/+2
| | | | | | makefile-based build for LSan llvm-svn: 182465
* [asan] LSan hooks in asan_allocator2.ccSergey Matveev2013-05-211-1/+81
| | | | llvm-svn: 182379
* Fix realloc'ing freed/invalid pointersTimur Iskhodzhanov2013-05-201-11/+31
| | | | | | See https://code.google.com/p/address-sanitizer/issues/detail?id=187 for the details llvm-svn: 182255
OpenPOWER on IntegriCloud