From c41b7fc414d3bf0e1a29014b6698a6e292fe17fb Mon Sep 17 00:00:00 2001 From: "mark@chromium.org" Date: Tue, 22 Jul 2014 14:24:21 +0000 Subject: 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 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 --- src/common/memory.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') 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 #include +#if defined(MEMORY_SANITIZER) +#include +#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(a); header->next = last_; header->num_pages = num_pages; -- cgit v1.2.1