[compiler-rt] r251445 - [asan] On OS X, tag mapped regions with VM_MEMORY_ANALYSIS_TOOL tag

Anna Zaks via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 27 13:12:53 PDT 2015


Author: zaks
Date: Tue Oct 27 15:12:53 2015
New Revision: 251445

URL: http://llvm.org/viewvc/llvm-project?rev=251445&view=rev
Log:
[asan] On OS X, tag mapped regions with VM_MEMORY_ANALYSIS_TOOL tag

This will tag all mmapped memory sanitizers use with "Performance tool data"
when viewed in vmmap. (Even though sanitizers are not performance tools, it's
the best available match and better than having the unidentified objects.)

http://reviews.llvm.org/D13609

Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc?rev=251445&r1=251444&r2=251445&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc Tue Oct 27 15:12:53 2015
@@ -41,6 +41,7 @@ extern char **environ;
 #include <libkern/OSAtomic.h>
 #include <mach-o/dyld.h>
 #include <mach/mach.h>
+#include <mach/vm_statistics.h>
 #include <pthread.h>
 #include <sched.h>
 #include <signal.h>
@@ -59,6 +60,7 @@ namespace __sanitizer {
 // ---------------------- sanitizer_libc.h
 uptr internal_mmap(void *addr, size_t length, int prot, int flags,
                    int fd, u64 offset) {
+  if (fd == -1) fd = VM_MAKE_TAG(VM_MEMORY_ANALYSIS_TOOL);
   return (uptr)mmap(addr, length, prot, flags, fd, offset);
 }
 




More information about the llvm-commits mailing list