[PATCH] D39888: [lsan] Only use VM_MEMORY_OS_ALLOC_ONCE on Darwin versions that support it

Rainer Orth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 10 01:15:52 PST 2017


ro created this revision.

Some time ago, the sanitizers as of r315899 were imported into gcc mainline.  This broke
bootstrap on Darwin 10 and 11, as reported in GCC PR sanitizer/82824
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82824) due to the unconditional use
of VM_MEMORY_OS_ALLOC_ONCE.  This was only introduced in Darwin 13/Mac OS X 10.9.

The use of the macro was introduced in r300450.

I couldn't find any statement which Darwin versions are supposed to be supported by
LLVM, but the trivial patch to use the macro only if present allowed the gcc bootstrap
to finish.

So far, I haven't tried building llvm/compiler-rt  on Darwin 11.  Maybe the patch is
simple enough to go in nonetheless.


https://reviews.llvm.org/D39888

Files:
  lib/lsan/lsan_common_mac.cc


Index: lib/lsan/lsan_common_mac.cc
===================================================================
--- lib/lsan/lsan_common_mac.cc
+++ lib/lsan/lsan_common_mac.cc
@@ -155,6 +155,7 @@
 
     uptr end_address = address + size;
 
+#ifdef VM_MEMORY_OS_ALLOC_ONCE
     // libxpc stashes some pointers in the Kernel Alloc Once page,
     // make sure not to report those as leaks.
     if (info.user_tag == VM_MEMORY_OS_ALLOC_ONCE) {
@@ -166,6 +167,7 @@
       if (!flags()->use_root_regions || !root_regions->size())
         break;
     }
+#endif
 
     // This additional root region scan is required on Darwin in order to
     // detect root regions contained within mmap'd memory regions, because


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39888.122401.patch
Type: text/x-patch
Size: 700 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171110/7c585a35/attachment.bin>


More information about the llvm-commits mailing list