[PATCH] D65771: [Sanitizer] Linux refactor shadow huge page mode handling
David CARLIER via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 5 13:57:33 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL367925: [Sanitizer] Linux refactor shadow huge page mode handling (authored by devnexen, committed by ).
Herald added a subscriber: delcypher.
Changed prior to commit:
https://reviews.llvm.org/D65771?vs=213439&id=213457#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65771/new/
https://reviews.llvm.org/D65771
Files:
compiler-rt/trunk/lib/asan/asan_shadow_setup.cpp
compiler-rt/trunk/lib/hwasan/hwasan_linux.cpp
compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h
compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cpp
compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cpp
compiler-rt/trunk/lib/tsan/rtl/tsan_platform_posix.cpp
Index: compiler-rt/trunk/lib/tsan/rtl/tsan_platform_posix.cpp
===================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_platform_posix.cpp
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_platform_posix.cpp
@@ -30,14 +30,13 @@
"TSAN_OPTIONS=%s=0\n";
static void NoHugePagesInShadow(uptr addr, uptr size) {
- if (common_flags()->no_huge_pages_for_shadow)
- if (!NoHugePagesInRegion(addr, size)) {
- Printf(kShadowMemoryMappingWarning, SanitizerToolName, addr, addr + size,
- "MADV_NOHUGEPAGE", errno);
- Printf(kShadowMemoryMappingHint, "MADV_NOHUGEPAGE",
- "no_huge_pages_for_shadow");
- Die();
- }
+ if (!SetShadowRegionHugePageMode(addr, size)) {
+ Printf(kShadowMemoryMappingWarning, SanitizerToolName, addr, addr + size,
+ "MADV_NOHUGEPAGE", errno);
+ Printf(kShadowMemoryMappingHint, "MADV_NOHUGEPAGE",
+ "no_huge_pages_for_shadow");
+ Die();
+ }
}
static void DontDumpShadow(uptr addr, uptr size) {
Index: compiler-rt/trunk/lib/asan/asan_shadow_setup.cpp
===================================================================
--- compiler-rt/trunk/lib/asan/asan_shadow_setup.cpp
+++ compiler-rt/trunk/lib/asan/asan_shadow_setup.cpp
@@ -37,7 +37,7 @@
size);
Abort();
}
- if (common_flags()->no_huge_pages_for_shadow) NoHugePagesInRegion(beg, size);
+ SetShadowRegionHugePageMode(beg, size);
if (common_flags()->use_madv_dontdump) DontDumpShadowMemory(beg, size);
}
Index: compiler-rt/trunk/lib/hwasan/hwasan_linux.cpp
===================================================================
--- compiler-rt/trunk/lib/hwasan/hwasan_linux.cpp
+++ compiler-rt/trunk/lib/hwasan/hwasan_linux.cpp
@@ -211,8 +211,7 @@
static void MadviseShadowRegion(uptr beg, uptr end) {
uptr size = end - beg + 1;
- if (common_flags()->no_huge_pages_for_shadow)
- NoHugePagesInRegion(beg, size);
+ SetShadowRegionHugePageMode(beg, size);
if (common_flags()->use_madv_dontdump)
DontDumpShadowMemory(beg, size);
}
Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cpp
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cpp
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cpp
@@ -68,9 +68,11 @@
SANITIZER_MADVISE_DONTNEED);
}
-bool NoHugePagesInRegion(uptr addr, uptr size) {
+bool SetShadowRegionHugePageMode(uptr addr, uptr size) {
#ifdef MADV_NOHUGEPAGE // May not be defined on old systems.
- return madvise((char *)addr, size, MADV_NOHUGEPAGE) == 0;
+ if (common_flags()->no_huge_pages_for_shadow)
+ return madvise((char *)addr, size, MADV_NOHUGEPAGE) == 0;
+ return true;
#else
return true;
#endif // MADV_NOHUGEPAGE
Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h
@@ -131,7 +131,7 @@
void IncreaseTotalMmap(uptr size);
void DecreaseTotalMmap(uptr size);
uptr GetRSS();
-bool NoHugePagesInRegion(uptr addr, uptr length);
+bool SetShadowRegionHugePageMode(uptr addr, uptr length);
bool DontDumpShadowMemory(uptr addr, uptr length);
// Check if the built VMA size matches the runtime one.
void CheckVMASize();
Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cpp
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cpp
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cpp
@@ -329,7 +329,7 @@
// FIXME: add madvise-analog when we move to 64-bits.
}
-bool NoHugePagesInRegion(uptr addr, uptr size) {
+bool SetShadowRegionHugePageMode(uptr addr, uptr size) {
// FIXME: probably similar to ReleaseMemoryToOS.
return true;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65771.213457.patch
Type: text/x-patch
Size: 3938 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190805/2e7b21f8/attachment.bin>
More information about the llvm-commits
mailing list