Allow for lack of VM_MEMORY_OS_ALLOC_ONCE on Mac OS X (PR sanitizer/82824)
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Sat, 13 Jan 2018 21:01:27 +0000 (21:01 +0000)
committerRainer Orth <ro@gcc.gnu.org>
Sat, 13 Jan 2018 21:01:27 +0000 (21:01 +0000)
PR sanitizer/82824
* lsan/lsan_common_mac.cc: Cherry-pick upstream r322437.

From-SVN: r256650

libsanitizer/ChangeLog
libsanitizer/lsan/lsan_common_mac.cc

index e5cad19bb5e3da859e162cec9a46ef0a32017bee..2f57f6acd8252b9b9f823d165a2288506323baed 100644 (file)
@@ -1,3 +1,8 @@
+2018-01-13  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+       PR sanitizer/82824
+       * lsan/lsan_common_mac.cc: Cherry-pick upstream r322437.
+
 2017-12-05  Martin Liska  <mliska@suse.cz>
            Jakub Jelinek  <jakub@redhat.com>
 
index e60b3d0f195db81763940f5be01f30f91061e7dd..6e763dab7f8627e5c0282ce336888d47dfd3f27d 100644 (file)
 
 #include <mach/mach.h>
 
+// Only introduced in Mac OS X 10.9.
+#ifdef VM_MEMORY_OS_ALLOC_ONCE
+static const int kSanitizerVmMemoryOsAllocOnce = VM_MEMORY_OS_ALLOC_ONCE;
+#else
+static const int kSanitizerVmMemoryOsAllocOnce = 73;
+#endif
+
 namespace __lsan {
 
 typedef struct {
@@ -155,7 +162,7 @@ void ProcessPlatformSpecificAllocations(Frontier *frontier) {
 
     // 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) {
+    if (info.user_tag == kSanitizerVmMemoryOsAllocOnce) {
       ScanRangeForPointers(address, end_address, frontier, "GLOBAL",
                            kReachable);