summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_posix_libcdep.cpp
diff options
context:
space:
mode:
authorDavid Carlier <devnexen@gmail.com>2019-08-06 21:30:03 +0000
committerDavid Carlier <devnexen@gmail.com>2019-08-06 21:30:03 +0000
commit325ce8e079cdc8d652bb5da709321598198b8c8a (patch)
tree6d3760f665527f9acea8307a9958a3a8ef872638 /lib/sanitizer_common/sanitizer_posix_libcdep.cpp
parentc54aa30626d8b03a25b270eb674197269378888f (diff)
downloadcompiler-rt-325ce8e079cdc8d652bb5da709321598198b8c8a.tar.gz
[Sanitizer] Linux explicitally migrate shadow mapping to Transparent Huge Page
in madvise mode, the shadow pages will be migrated only via madvise explicit calls. Reviewers: vitalybuka Reviewed By: vitalybuka Differential Revision: https://reviews.llvm.org/D65775 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@368090 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_posix_libcdep.cpp')
-rw-r--r--lib/sanitizer_common/sanitizer_posix_libcdep.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/sanitizer_common/sanitizer_posix_libcdep.cpp b/lib/sanitizer_common/sanitizer_posix_libcdep.cpp
index ad8a1ec99..24c42f3c9 100644
--- a/lib/sanitizer_common/sanitizer_posix_libcdep.cpp
+++ b/lib/sanitizer_common/sanitizer_posix_libcdep.cpp
@@ -68,13 +68,12 @@ void ReleaseMemoryPagesToOS(uptr beg, uptr end) {
SANITIZER_MADVISE_DONTNEED);
}
-bool SetShadowRegionHugePageMode(uptr addr, uptr size) {
+void SetShadowRegionHugePageMode(uptr addr, uptr size) {
#ifdef MADV_NOHUGEPAGE // May not be defined on old systems.
if (common_flags()->no_huge_pages_for_shadow)
- return madvise((char *)addr, size, MADV_NOHUGEPAGE) == 0;
- return true;
-#else
- return true;
+ madvise((char *)addr, size, MADV_NOHUGEPAGE);
+ else
+ madvise((char *)addr, size, MADV_HUGEPAGE) == 0;
#endif // MADV_NOHUGEPAGE
}