[PATCH] D54469: Introduce new `disable_init` ASan option that is only supported on platforms where `SANITIZER_SUPPORTS_DISABLED_INIT` is true. Currently this is only supported on Darwin.

Dan Liew via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 13 04:40:54 PST 2018


delcypher created this revision.
delcypher added reviewers: kubamracek, george.karpenkov, kcc, eugenis, krytarowski.
Herald added a subscriber: Sanitizers.

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.

Platforms where `SANITIZER_SUPPORTS_DISABLED_INIT` is true must
implement the `__asan::HandleDisabledInit()` function. On Darwin
this ensures that the ASan malloc zone fields are initialized.

Although disabling initialization is something that could potentially
apply to other sanitizers it appears to be unnecessary for other
sanitizers so this patch just makes the change for ASan. On Darwin it
looks like LSan and TSan perform init when one of the interceptors get
called (won't affect `dlopen()` on Darwin). UBSan technically performs
init via a global constructor like ASan. However UBSan's runtime init
won't cause `dlopen` problems like ASan's init does.

rdar://problem/45284065


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D54469

Files:
  lib/asan/asan_flags.inc
  lib/asan/asan_internal.h
  lib/asan/asan_malloc_mac.cc
  lib/asan/asan_rtl.cc
  lib/sanitizer_common/sanitizer_platform.h
  test/asan/TestCases/Darwin/disable_init.cc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54469.173832.patch
Type: text/x-patch
Size: 4101 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181113/a536065b/attachment.bin>


More information about the llvm-commits mailing list