[PATCH] D32968: Add dyld to sanitizer procmaps on darwin

Francis Ricci via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 8 08:15:21 PDT 2017


fjricci created this revision.

Sanitizer procmaps uses dyld apis to iterate over the list of images
in the process. This is much more performan than manually recursing
over all of the memory regions in the process, however, dyld does
not report itself in the list of images. In order to prevent reporting
leaks from dyld globals and to symbolize dyld functions in stack traces,
this patch special-cases dyld and ensures that it is added to the
list of modules.

This is accomplished by recursing through the memory map of the process
until a dyld Mach header is found. While this recursion is expensive,
it is run before the full set of images has been loaded in the process,
so only a few calls are required. The result is cached so that it never
needs to be searched for when the full process memory map exists, as this
would be incredibly slow, on the order of minutes for leak sanitizer with
only 25 or so libraries loaded.

Change-Id: I2458f09efdc66931242f44a6dae07352c498b8de


https://reviews.llvm.org/D32968

Files:
  lib/sanitizer_common/sanitizer_procmaps.h
  lib/sanitizer_common/sanitizer_procmaps_mac.cc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32968.98169.patch
Type: text/x-patch
Size: 8017 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170508/0ed78136/attachment.bin>


More information about the llvm-commits mailing list