[msan] Do not unpoison heap if running on simulator.

With the simulator, MSan detects all memory accesses from JIT code
without the need for annotations.

We'd like to keep the annotation in the native (w/o simulator) mode
until we can move all MSan+V8 users to simulator mode.

R=jkummerow@chromium.org

Review URL: https://codereview.chromium.org/212833002

Patch from Evgeniy Stepanov <eugenis@chromium.org>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20399 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
jkummerow@chromium.org 2014-04-01 12:45:00 +00:00
parent 1d19dc9e45
commit 4fe93b2d22
2 changed files with 7 additions and 5 deletions

View File

@ -30,6 +30,8 @@
#ifndef V8_MSAN_H_ #ifndef V8_MSAN_H_
#define V8_MSAN_H_ #define V8_MSAN_H_
#include "globals.h"
#ifndef __has_feature #ifndef __has_feature
# define __has_feature(x) 0 # define __has_feature(x) 0
#endif #endif
@ -38,12 +40,12 @@
# define MEMORY_SANITIZER # define MEMORY_SANITIZER
#endif #endif
#ifdef MEMORY_SANITIZER #if defined(MEMORY_SANITIZER) && !defined(USE_SIMULATOR)
# include <sanitizer/msan_interface.h> # include <sanitizer/msan_interface.h> // NOLINT
// Marks a memory range as fully initialized. // Marks a memory range as fully initialized.
# define MSAN_MEMORY_IS_INITIALIZED(p, s) __msan_unpoison((p), (s)) # define MSAN_MEMORY_IS_INITIALIZED_IN_JIT(p, s) __msan_unpoison((p), (s))
#else #else
# define MSAN_MEMORY_IS_INITIALIZED(p, s) # define MSAN_MEMORY_IS_INITIALIZED_IN_JIT(p, s)
#endif #endif
#endif // V8_MSAN_H_ #endif // V8_MSAN_H_

View File

@ -711,7 +711,7 @@ MemoryChunk* MemoryAllocator::AllocateChunk(intptr_t reserve_area_size,
executable, executable,
owner); owner);
result->set_reserved_memory(&reservation); result->set_reserved_memory(&reservation);
MSAN_MEMORY_IS_INITIALIZED(base, chunk_size); MSAN_MEMORY_IS_INITIALIZED_IN_JIT(base, chunk_size);
return result; return result;
} }