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
This commit is contained in:
parent
561f818735
commit
c41b7fc414
1 changed files with 10 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue