diff options
author | Reid Kleckner <rnk@google.com> | 2016-02-18 17:58:22 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2016-02-18 17:58:22 +0000 |
commit | 620682592cc389a3f3a518ddd10ed4c413f0b5ab (patch) | |
tree | e9423d106df3fd09a1f29ea60e0610652d98e2c4 /lib/sanitizer_common/sanitizer_win.cc | |
parent | 6606c7b50cbb4ec7eab4ecbebbbaaa049734bbd3 (diff) |
[WinASan] Fix page size and mmap granularity confusion
We were erroneously reporting 16K as the page size on Windows because
the code that does the shadow mapping was using page size instead of
allocation granularity. After fixing that, we can resolve the FIXMEs in
the Windows implementations of GetPageSize and GetMmapGranularity by
calling GetSystemInfo instead of returning hard-coded, incorrect
answers.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@261233 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_win.cc')
-rw-r--r-- | lib/sanitizer_common/sanitizer_win.cc | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/sanitizer_common/sanitizer_win.cc b/lib/sanitizer_common/sanitizer_win.cc index 4a6dc34cf..25eaa0d1e 100644 --- a/lib/sanitizer_common/sanitizer_win.cc +++ b/lib/sanitizer_common/sanitizer_win.cc @@ -35,13 +35,15 @@ namespace __sanitizer { // --------------------- sanitizer_common.h uptr GetPageSize() { - // FIXME: there is an API for getting the system page size (GetSystemInfo or - // GetNativeSystemInfo), but if we use it here we get test failures elsewhere. - return 1U << 14; + SYSTEM_INFO si; + GetSystemInfo(&si); + return si.dwPageSize; } uptr GetMmapGranularity() { - return 1U << 16; // FIXME: is this configurable? + SYSTEM_INFO si; + GetSystemInfo(&si); + return si.dwAllocationGranularity; } uptr GetMaxVirtualAddress() { |