[PATCH] D14330: [tsan] Use malloc zone interceptors on OS X

Kuba Brecka via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 4 04:46:28 PST 2015


kubabrecka created this revision.
kubabrecka added reviewers: dvyukov, samsonov, glider, kcc.
kubabrecka added subscribers: llvm-commits, zaks.anna, ismailp, jasonk.

In ASan, we have a custom OS X malloc zone and a few malloc-related interceptors implemented in `asan_malloc_mac.cc`.  Since intercepting just malloc/realloc/free is not enough for OS X (we will miss some allocations), we need to implement the malloc zone for TSan as well.

This patch moves the malloc zone implementation into `sanitizer_malloc_mac.inc` and factors out the ASan-specific details, which remain in `asan_malloc_mac.cc`.  After that, TSan can reuse that in `tsan_malloc_mac.cc`.  All of this is done via macros (`COMMON_MALLOC_*`), mostly because of the stack trace handling in interceptors (and the interceptors themselves need to be in a .inc file).

There are a few pieces missing in the TSan's use of the malloc zone (e.g. `COMMON_MALLOC_FILL_STATS` is empty), but they're not really required and I'd like to first get to a point where we can actually *run* TSan without crashing during startup (before we implement non-essential features).

(This is part of an effort to port TSan to OS X, and it's one the very first steps. Don't expect TSan on OS X to actually work or pass tests at this point.)


http://reviews.llvm.org/D14330

Files:
  lib/asan/asan_malloc_mac.cc
  lib/sanitizer_common/sanitizer_malloc_mac.inc
  lib/tsan/CMakeLists.txt
  lib/tsan/rtl/tsan_interceptors.cc
  lib/tsan/rtl/tsan_malloc_mac.cc
  lib/tsan/rtl/tsan_mman.h
  lib/tsan/rtl/tsan_platform_linux.cc
  lib/tsan/rtl/tsan_rtl.cc
  test/asan/TestCases/Darwin/interface_symbols_darwin.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14330.39189.patch
Type: text/x-patch
Size: 31339 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151104/00f2dd26/attachment-0001.bin>


More information about the llvm-commits mailing list