[Sanitizer][Darwin] Add interceptor for malloc_zone_from_ptr
authorJulian Lettner <jlettner@apple.com>
Fri, 9 Aug 2019 21:46:32 +0000 (21:46 +0000)
committerJulian Lettner <jlettner@apple.com>
Fri, 9 Aug 2019 21:46:32 +0000 (21:46 +0000)
commit5ef4b190d9910fa6bfbd7406ea6629b53e4e8d79
tree3ff75071c65dce08d23733ec7b64c79fe38f85c0
parent0fd073b1bff8a92a0e911773255354b6f6fd8e88
[Sanitizer][Darwin] Add interceptor for malloc_zone_from_ptr

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
compiler-rt/lib/sanitizer_common/sanitizer_malloc_mac.inc
compiler-rt/test/sanitizer_common/TestCases/Darwin/malloc_zone.cpp [new file with mode: 0644]