diff options
author | mark@chromium.org <mark@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2014-07-22 14:24:21 +0000 |
---|---|---|
committer | mark@chromium.org <mark@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2014-07-22 14:24:21 +0000 |
commit | c41b7fc414d3bf0e1a29014b6698a6e292fe17fb (patch) | |
tree | 450a1e85da6dcb26dad10f2624bae27ee1f7e504 /src | |
parent | Chrome on Android now supports loading the shared library directly from the A... (diff) | |
download | breakpad-c41b7fc414d3bf0e1a29014b6698a6e292fe17fb.tar.xz |
Annotate PageAllocator for MSan.
PageAllocator maps memory via sys_mmap(), implemented in
linux_syscall_support.h. We need to explicitly inform MSan that this memory is
initialized.
Patch by Sergey Matveev <earthdok@chromium.org>
BUG=chromium:394028
Review URL: https://breakpad.appspot.com/2744002/
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1356 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src')
-rw-r--r-- | src/common/memory.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/common/memory.h b/src/common/memory.h index a4cad94c..03228f07 100644 --- a/src/common/memory.h +++ b/src/common/memory.h @@ -38,6 +38,10 @@ #include <memory> #include <vector> +#if defined(MEMORY_SANITIZER) +#include <sanitizer/msan_interface.h> +#endif + #ifdef __APPLE__ #define sys_mmap mmap #define sys_mmap2 mmap @@ -120,6 +124,12 @@ class PageAllocator { if (a == MAP_FAILED) return NULL; +#if defined(MEMORY_SANITIZER) + // We need to indicate to MSan that memory allocated through sys_mmap is + // initialized, since linux_syscall_support.h doesn't have MSan hooks. + __msan_unpoison(a, page_size_ * num_pages); +#endif + struct PageHeader *header = reinterpret_cast<PageHeader*>(a); header->next = last_; header->num_pages = num_pages; |