From 725ce114aa74f8688b83a2fa7edf51670fd5f92b Mon Sep 17 00:00:00 2001 From: "jkummerow@chromium.org" Date: Tue, 1 Apr 2014 12:48:35 +0000 Subject: [PATCH] MSan does not understand inline asm. This change preinitializes cpuid results, and disables the use of stos. Random mmap() addresses conflict with sanitizer memory layout. R=jkummerow@chromium.org Review URL: https://codereview.chromium.org/212723003 Patch from Evgeniy Stepanov . git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20400 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/atomicops_internals_x86_gcc.cc | 8 ++++---- src/platform-posix.cc | 5 +++++ src/v8utils.h | 5 +++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/atomicops_internals_x86_gcc.cc b/src/atomicops_internals_x86_gcc.cc index 950b423..a119cd2 100644 --- a/src/atomicops_internals_x86_gcc.cc +++ b/src/atomicops_internals_x86_gcc.cc @@ -77,10 +77,10 @@ namespace { void AtomicOps_Internalx86CPUFeaturesInit() { using v8::internal::AtomicOps_Internalx86CPUFeatures; - uint32_t eax; - uint32_t ebx; - uint32_t ecx; - uint32_t edx; + uint32_t eax = 0; + uint32_t ebx = 0; + uint32_t ecx = 0; + uint32_t edx = 0; // Get vendor string (issue CPUID with eax = 0) cpuid(eax, ebx, ecx, edx, 0); diff --git a/src/platform-posix.cc b/src/platform-posix.cc index 5ca1252..20c2533 100644 --- a/src/platform-posix.cc +++ b/src/platform-posix.cc @@ -214,6 +214,11 @@ void* OS::GetRandomMmapAddr() { // See http://code.google.com/p/nativeclient/issues/3341 return NULL; #endif +#if defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER) || \ + defined(THREAD_SANITIZER) + // Dynamic tools do not support custom mmap addresses. + return NULL; +#endif Isolate* isolate = Isolate::UncheckedCurrent(); // Note that the current isolate isn't set up in a call path via // CpuFeatures::Probe. We don't care about randomization in this case because diff --git a/src/v8utils.h b/src/v8utils.h index 058b153..32c5c2e 100644 --- a/src/v8utils.h +++ b/src/v8utils.h @@ -215,6 +215,11 @@ inline void MemsetPointer(T** dest, U* value, int counter) { #undef STOS #endif +#if defined(MEMORY_SANITIZER) + // MemorySanitizer does not understand inline assembly. +#undef STOS +#endif + #if defined(__GNUC__) && defined(STOS) asm volatile( "cld;" -- 2.7.4