summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common/sanitizer_malloc_mac.inc
Commit message (Collapse)AuthorAgeFilesLines
* [Sanitizer][Darwin] Add interceptor for malloc_zone_from_ptrJulian Lettner2019-08-091-1/+10
| | | | | | | | | | | | | | | | | Ensure that malloc_default_zone and malloc_zone_from_ptr return the sanitizer-installed malloc zone even when MallocStackLogging (MSL) is requested. This prevents crashes in certain situations. Note that the sanitizers and MSL cannot be used together. If both are enabled, MSL functionality is essentially deactivated since it only hooks the default allocator which is replaced by a custom sanitizer allocator. rdar://53686175 Reviewed By: kubamracek Differential Revision: https://reviews.llvm.org/D65990 llvm-svn: 368492
* On Darwin add allocator address and size fields toDan Liew2019-01-211-0/+25
| | | | | | | | | | | | | | `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-4/+19
| | | | | | | | | | | | | | | | 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
* Add new `__sanitizer_mz_default_zone()` API which returns the address of the ↵Dan Liew2018-12-061-0/+7
| | | | | | | | | | | | | | | | ASan malloc zone. This API will be used for testing in future patches. Summary: The name of the function is based on `malloc_default_zone()` found in Darwin's `malloc/malloc.h` header file. Reviewers: kubamracek, george.karpenkov Subscribers: #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D55064 llvm-svn: 348481
* Introduce `sanitizer_malloc_introspect_t` for Darwin which is a sub-class of ↵Dan Liew2018-11-081-1/+23
| | | | | | | | | | | | | | | | | | | | | | Darwin's `malloc_introspection_t` and use it when setting up the malloc zone. Summary: Currently `sanitizer_malloc_introspection_t` just adds a version field which is used to version the allocator ABI. The current allocator ABI version is returned by the new `GetMallocZoneAllocatorEnumerationVersion()` function. The motivation behind this change is to allow external processes to determine the allocator ABI of a sanitized process. rdar://problem/45284065 Reviewers: kubamracek, george.karpenkov, vitalybuka Subscribers: #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D54045 llvm-svn: 346420
* [NFC] Refactor initialisation of Darwin malloc zone fields into separate ↵Dan Liew2018-11-021-1/+5
| | | | | | | | | | | | | | | | | | function called `InitMallocZoneFields()` which is now called from `ReplaceSystemMalloc()`. Summary: The motivation here is to be able support initialisation of the malloc zone on other code paths. rdar://problem/45284065 Reviewers: kubamracek, george.karpenkov Subscribers: llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D54037 llvm-svn: 345983
* [sanitizer] Fix Darwin buildVitaly Buka2018-03-241-0/+4
| | | | llvm-svn: 328417
* Mmap interceptor providing mprotect supportVitaly Buka2018-03-241-25/+0
| | | | | | | | | | | | | | | | Summary: - Intercepting mprotect calls. - Fixing forgotten flag check. Patch by David CARLIER Reviewers: vitalybuka, vsk Subscribers: delcypher, srhines, kubamracek, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D44777 llvm-svn: 328415
* [Sanitizers] Add more standard compliant posix_memalign implementation for LSan.Alex Shlyapnikov2018-03-121-6/+2
| | | | | | | | | | | | | | | 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
* Free zone name when destroying malloc zoneFrancis Ricci2017-04-131-0/+3
| | | | | | | | | | | | | | | Summary: The darwin interceptor for malloc_destroy_zone manually frees the zone struct, but does not free the name component. Make sure to free the name if it has been set. Reviewers: kubamracek, alekseyshl Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D31983 llvm-svn: 300195
* [sanitizer] Make sure libmalloc doesn't remove the sanitizer zone from ↵Kuba Mracek2016-12-111-0/+23
| | | | | | | | | | malloc_zones[0] In certain OS versions, it was possible that libmalloc replaced the sanitizer zone from being the default zone (i.e. being in malloc_zones[0]). This patch introduces a failsafe that makes sure we always stay the default zone. No testcase for this, because this doesn't reproduce under normal circumstances. Differential Revision: https://reviews.llvm.org/D27083 llvm-svn: 289376
* [sanitizer] Handle malloc_destroy_zone() on DarwinKuba Mracek2016-12-111-0/+13
| | | | | | | | We currently have a interceptor for malloc_create_zone, which returns a new zone that redirects all the zone requests to our sanitizer zone. However, calling malloc_destroy_zone on that zone will cause libmalloc to print out some warning messages, because the zone is not registered in the list of zones. This patch handles this and adds a testcase for that. Differential Revision: https://reviews.llvm.org/D27083 llvm-svn: 289375
* [libsanitizer] Fix bugs and wiki links to point to GitHub.Alexander Potapenko2015-12-041-2/+2
| | | | llvm-svn: 254738
* [ASan] Retire mac_ignore_invalid_free, remove some dead code.Alexander Potapenko2015-12-041-16/+6
| | | | | | | | | | 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
* [asan] Remove system_malloc_zoneKuba Brecka2015-11-121-14/+3
| | | | | | | | This seems to be dead code – `system_malloc_zone` is initialized as null and we never assign to it. This code is apparently currently never executed (in ASan), but is causes trouble for the TSan OS X port. Let's replace the checks with `COMMON_MALLOC_ENTER` (`ENSURE_ASAN_INITED()`). Differential Revision: http://reviews.llvm.org/D14334 llvm-svn: 252876
* Whitespace fixup for r252052. NFC.Kuba Brecka2015-11-041-1/+2
| | | | llvm-svn: 252053
* [tsan] Use malloc zone interceptors on OS X, part 1 (refactoring)Kuba Brecka2015-11-041-0/+349
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
OpenPOWER on IntegriCloud