summaryrefslogtreecommitdiff
path: root/lib/lsan
diff options
context:
space:
mode:
authorFrancis Ricci <francisjricci@gmail.com>2018-01-13 14:43:49 +0000
committerFrancis Ricci <francisjricci@gmail.com>2018-01-13 14:43:49 +0000
commitcc0796dba41decd108241a826de71ee4b8dacbd3 (patch)
treefafebde04f2f1199e1529ea8be47a8c4989fdff1 /lib/lsan
parent456e800a8f8f3a495af810bef705f5fed5a5ceb9 (diff)
[Sanitizers, LSan, Darwin] Allow for lack of VM_MEMORY_OS_ALLOC_ONCE
Summary: 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. Committing on behalf of ro. Reviewers: glider, fjricci, kcc, kuba, kubamracek, george.karpenkov Reviewed By: fjricci Subscribers: #sanitizers, zaks.anna, srhines, dberris, kubamracek, llvm-commits Tags: #sanitizers Differential Revision: https://reviews.llvm.org/D39888 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@322437 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/lsan')
-rw-r--r--lib/lsan/lsan_common_mac.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/lsan/lsan_common_mac.cc b/lib/lsan/lsan_common_mac.cc
index ac27c7af6..b8f8b25f6 100644
--- a/lib/lsan/lsan_common_mac.cc
+++ b/lib/lsan/lsan_common_mac.cc
@@ -24,6 +24,13 @@
#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 {
@@ -157,7 +164,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);