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 950b423f41..a119cd2ab2 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 5ca12522c1..20c25338be 100644 --- a/src/platform-posix.cc +++ b/src/platform-posix.cc @@ -213,6 +213,11 @@ void* OS::GetRandomMmapAddr() { // smarter about using mmap address hints. // 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 diff --git a/src/v8utils.h b/src/v8utils.h index 058b153a7e..32c5c2e5d3 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;"