summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/asan/asan_malloc_mac.cc
Commit message (Collapse)AuthorAgeFilesLines
* compiler-rt: Rename .cc file in lib/asan to .cppNico Weber2019-08-011-102/+0
| | | | | | Like r367463, but for asan. llvm-svn: 367558
* [ASan] On Darwin record global allocator pointer and size in introspection ↵Dan Liew2019-01-211-1/+17
| | | | | | | | | | | | struct. This implements `mi_extra_init(...)` for the ASan allocator on Darwin and uses the `__lsan::GetAllocatorGlobalRange(...)` function to retrieve the allocator pointer and size. rdar://problem/45284065 llvm-svn: 351713
* On Darwin add allocator address and size fields toDan Liew2019-01-211-0/+1
| | | | | | | | | | | | | | `sanitizer_malloc_introspection_t` and initialize them to zero. We allow sanitizer implementations to perform different initialization by defining `COMMON_MALLOC_HAS_EXTRA_INTROSPECTION_INIT` to be `1` and providing an implementation of `mi_extra_init(...)`. We use these changes in future patches to implement malloc zone enumeration. rdar://problem/45284065 llvm-svn: 351712
* On Darwin allow for sanitizer malloc implementations to provide a zoneDan Liew2019-01-211-0/+1
| | | | | | | | | | | | | | | | enumerator. This is done by defining `COMMON_MALLOC_HAS_ZONE_ENUMERATOR` to `1` and then by providing an implementation of the `mi_enumerator(...)` function. If a custom implementation isn't desired the macro is set to `0` which causes a stub version (that fails) to be used. Currently all Darwin sanitizers that have malloc implementations define this to be `0` so there is no functionality change. rdar://problem/45284065 llvm-svn: 351711
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Introduce a way to allow the ASan dylib on Darwin platforms to be loaded via ↵Dan Liew2018-12-011-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `dlopen()`. Summary: The purpose of this option is provide a way for the ASan dylib to be loaded via `dlopen()` without triggering most initialization steps (e.g. shadow memory set up) that normally occur when the ASan dylib is loaded. This new functionality is exposed by - A `SANITIZER_SUPPORTS_INIT_FOR_DLOPEN` macro which indicates if the feature is supported. This only true for Darwin currently. - A `HandleDlopenInit()` function which should return true if the library is being loaded via `dlopen()` and `SANITIZER_SUPPORTS_INIT_FOR_DLOPEN` is supported. Platforms that support this may perform any initialization they wish inside this function. Although disabling initialization is something that could potentially apply to other sanitizers it appears to be unnecessary for other sanitizers so this patch only makes the change for ASan. rdar://problem/45284065 Reviewers: kubamracek, george.karpenkov, kcc, eugenis, krytarowski Subscribers: #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D54469 llvm-svn: 348078
* [Sanitizers] Add more standard compliant posix_memalign implementation for LSan.Alex Shlyapnikov2018-03-121-0/+3
| | | | | | | | | | | | | | | 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
* [ASan] Retire mac_ignore_invalid_free, remove some dead code.Alexander Potapenko2015-12-041-4/+0
| | | | | | | | | | mac_ignore_invalid_free was helpful when ASan runtime used to intercept CFAllocator and sometimes corrupted its memory. This behavior had been long gone, and the flag was unused. This patch also deletes ReportMacCfReallocUnknown(), which was used by the CFAllocator realloc() wrapper. llvm-svn: 254722
* [tsan] Use malloc zone interceptors on OS X, part 1 (refactoring)Kuba Brecka2015-11-041-336/+39
| | | | | | | | TSan needs to use a custom malloc zone on OS X, which is already implemented in ASan. This patch is a refactoring patch (NFC) that extracts this from ASan into sanitizer_common, where we can reuse it in TSan. Reviewed at http://reviews.llvm.org/D14330 llvm-svn: 252052
* Revert "[ASan] Add the new __asan_mz_* symbols to asan_interface_internal.h"Juergen Ributzka2015-02-041-1/+1
| | | | | | Reverting r228137 to unbreak the build bots. llvm-svn: 228172
* [ASan] Add the new __asan_mz_* symbols to asan_interface_internal.hAlexander Potapenko2015-02-041-1/+1
| | | | | | to fix the interface_symbols_darwin.c test. llvm-svn: 228137
* [ASan] Remove ifdefs for MAC_OS_X_VERSION_10_6, as ASan assumes OSX >= 10.6Alexander Potapenko2015-02-031-18/+4
| | | | llvm-svn: 227968
* [ASan] Add __asan_ prefix for "mz_*" allocation/deallocation functionsAlexander Potapenko2015-02-031-20/+37
| | | | | | and make them global so that they're not removed by `strip -x`. llvm-svn: 227967
* Replace InternalScopedBuffer<char> with InternalScopedString where applicable.Alexey Samsonov2014-12-021-2/+2
| | | | | | | | | | | | | | | | Summary: No functionality change. Test Plan: make check-all Reviewers: kcc Reviewed By: kcc Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D6472 llvm-svn: 223164
* [asan] use some LIKELY/UNLIKELYKostya Serebryany2014-05-141-4/+4
| | | | llvm-svn: 208776
* [ASan] Get rid of asan_mac.h, which contents have been moved to sanitizer_mac.hAlexander Potapenko2014-02-041-1/+0
| | | | llvm-svn: 200757
* [ASan] Move GetMacosVersion() to sanitizer_common.Alexander Potapenko2014-02-031-0/+1
| | | | llvm-svn: 200700
* [asan] Fix a bunch of style issues.Evgeniy Stepanov2014-01-161-13/+13
| | | | llvm-svn: 199380
* [asan] Implement delayed activation of AddressSanitizerEvgeniy Stepanov2014-01-161-13/+13
| | | | | | | | | | | | 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
* [ASan] Do not protect the malloc zone created by malloc_zone_create() on ↵Alexander Potapenko2013-07-041-3/+6
| | | | | | | | Snow Leopard and earlier systems. Fixes https://code.google.com/p/address-sanitizer/issues/detail?id=208 llvm-svn: 185621
* [ASan][OSX] Make sure the zones created by malloc_create_zone() are ↵Alexander Potapenko2013-06-281-0/+4
| | | | | | | | write-protected. Add a test. llvm-svn: 185140
* [ASan][OSX] Fix the incorrect malloc_create_zone() implementation that led ↵Alexander Potapenko2013-06-281-1/+4
| | | | | | | | | to out-of-bounds mprotect()s (https://code.google.com/p/address-sanitizer/issues/detail?id=203) Add a test. llvm-svn: 185138
* [ASan] Kill the remainders of platform defines in favor of SANITIZER_ definesAlexey Samsonov2013-04-031-1/+1
| | | | llvm-svn: 178629
* [ASan] Switch ASan to generic ThreadRegistry from sanitizer_common. Delete ↵Alexey Samsonov2013-03-211-1/+0
| | | | | | ASan-specific AsanThreadRegistry. llvm-svn: 177634
* [ASan] Move malloc stats collection away from AsanThreadRegistry class.Alexey Samsonov2013-03-201-1/+1
| | | | llvm-svn: 177508
* [sanitizer] More renamed macros.Evgeniy Stepanov2013-03-191-1/+1
| | | | llvm-svn: 177401
* [sanitizer] Replace more platform checks with SANITIZER_ constants.Evgeniy Stepanov2013-03-191-0/+1
| | | | llvm-svn: 177400
* [ASan] Use dylib interposition to hook memory allocation in the dynamic runtime.Alexander Potapenko2013-01-221-176/+104
| | | | | | | | This CL drastically simplifies the way we're hooking the memory allocation routines in ASan on Mac by using dylib interposition to replace the main malloc_zone_* functions. This allows us to avoid replacing the default CFAllocator and drop the CF dependency at all. Committing this patch will result in the static runtime being broken. A follow-up CL will switch ASan to use the dynamic runtime library. llvm-svn: 173134
* [asan] add a flag alloc_dealloc_mismatch (off by default for now) which ↵Kostya Serebryany2012-12-211-5/+5
| | | | | | finds malloc/delete, new/free, new/delete[], etc mismatches llvm-svn: 170869
* [asan] fix mac buildKostya Serebryany2012-12-131-1/+1
| | | | llvm-svn: 170118
* [asan] add two asan flags: fast_unwind_on_fatal and fast_unwind_on_malloc to ↵Kostya Serebryany2012-12-131-14/+14
| | | | | | allow using the slow CFI-based unwinder llvm-svn: 170117
* [asan] get rid of some of the uses of kPageSize. The intent is to get rid of ↵Kostya Serebryany2012-11-231-1/+1
| | | | | | it completely to support platforms with multiple possible page sizes. llvm-svn: 168517
* [ASan] Rename ReplaceCFAllocator to MaybeReplaceCFAllocator.Alexander Potapenko2012-10-241-17/+11
| | | | | | Replace the allocator only if the replace_cfallocator flag is set (in some cases it wasn't checked) llvm-svn: 166550
* [Sanitizer] Remove unneeded returns after UNIMPLEMENTED macroAlexey Samsonov2012-10-091-2/+0
| | | | llvm-svn: 165493
* Give more accurate malloc statistics to malloc_zone_statistics().Alexander Potapenko2012-09-121-6/+6
| | | | | | Fix a warning in macros instantiation. llvm-svn: 163716
* [ASan] more macro/casting magic to suppress warningsAlexey Samsonov2012-09-121-1/+1
| | | | llvm-svn: 163706
* Initial support for malloc_zone_statistics. All counters are set to zero now.Alexander Potapenko2012-09-121-5/+2
| | | | | | This is required to overcome a crash in mstats() (http://code.google.com/p/address-sanitizer/issues/detail?id=109) llvm-svn: 163690
* For invalid pointers passed to free_common check whether they are actually ↵Alexander Potapenko2012-08-291-21/+43
| | | | | | | | | | skewed to hold an additional CFAllocatorRef. If so, fix the pointer and pass it to asan_free. See http://code.google.com/p/address-sanitizer/issues/detail?id=70 for more background. llvm-svn: 162839
* [asan] get rid of AsanPrintf in favor of Printf from sanitizer_commonKostya Serebryany2012-08-281-1/+1
| | | | llvm-svn: 162746
* Commit the source and CMake changes that will allow to build ASan runtimeAlexander Potapenko2012-08-171-1/+5
| | | | | | | as a shared library on Mac OS. This will provide an alternative to mach_override. llvm-svn: 162091
* Remove the setjmp.h dependency, fix the comment.Alexander Potapenko2012-08-101-2/+1
| | | | llvm-svn: 161662
* Temporary fix for ↵Alexander Potapenko2012-08-101-1/+9
| | | | | | | | http://code.google.com/p/address-sanitizer/issues/detail?id=99: when trying to free memory that actually belongs to the system purgeable zone, use malloc_zone_free(malloc_default_purgeable_zone(), ptr) instead of asan_free(). llvm-svn: 161661
* [ASan] Move mac-specific error reports to asan_report.cc as wellAlexey Samsonov2012-08-091-33/+10
| | | | llvm-svn: 161576
* Intercept CFAllocator for each thread in the program.Alexander Potapenko2012-07-231-2/+4
| | | | | | | Test that child threads use the ASan allocator, that allocated memory can be passed to another thread and deallocated on it. This should fix http://code.google.com/p/address-sanitizer/issues/detail?id=81 llvm-svn: 160630
* [ASan] Use common flags parsing machinery.Alexey Samsonov2012-07-091-4/+4
| | | | llvm-svn: 159933
* Small fix: do not replace the default CFAllocator if it has been replaced ↵Alexander Potapenko2012-07-061-1/+1
| | | | | | already. llvm-svn: 159824
* Because CFAllocatorCreate() should also be called after __CFInitialize() on ↵Alexander Potapenko2012-07-061-16/+26
| | | | | | | | | Lion, do so by factoring the CFAllocator logic into ReplaceCFAllocator(), which is called from either the __CFInitialize wrapper or __asan_init(), depending on which of them is called later. llvm-svn: 159822
* A portable way to check whether __CFInitialize has been called: compare ↵Alexander Potapenko2012-07-061-7/+4
| | | | | | | | kCFAllocatorSystemDefault._base._cfisa to 0. This should fix http://code.google.com/p/address-sanitizer/issues/detail?id=87 on both Lion and Snow Leopard. llvm-svn: 159821
* Do not check for __CFRuntimeClassTableSize on non-10.6 systems, where this ↵Alexander Potapenko2012-07-061-3/+12
| | | | | | | | symbol is private. This change may cause http://code.google.com/p/address-sanitizer/issues/detail?id=87 to re-appear on Lion. llvm-svn: 159819
* Fix http://code.google.com/p/address-sanitizer/issues/detail?id=87 by making ↵Alexander Potapenko2012-07-051-2/+21
| | | | | | sure we replace the default CFAllocator only after __CFInitialize has been called. llvm-svn: 159749
OpenPOWER on IntegriCloud