summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--compiler-rt/lib/msan/msan.cc4
-rw-r--r--compiler-rt/lib/msan/msan_linux.cc6
2 files changed, 9 insertions, 1 deletions
diff --git a/compiler-rt/lib/msan/msan.cc b/compiler-rt/lib/msan/msan.cc
index e0d1b6cef8c..e0bff820312 100644
--- a/compiler-rt/lib/msan/msan.cc
+++ b/compiler-rt/lib/msan/msan.cc
@@ -240,8 +240,10 @@ void __msan_init() {
if (!InitShadow(/* prot1 */false, /* prot2 */true, /* map_shadow */true,
__msan_track_origins)) {
// FIXME: prot1 = false is only required when running under DR.
- Printf("FATAL: MemorySanitizer can not mmap the shadow memory\n");
+ Printf("FATAL: MemorySanitizer can not mmap the shadow memory.\n");
Printf("FATAL: Make sure to compile with -fPIE and to link with -pie.\n");
+ Printf("FATAL: Disabling ASLR is known to cause this error.\n");
+ Printf("FATAL: If running under GDB, try 'set disable-randomization off'.\n");
DumpProcessMap();
Die();
}
diff --git a/compiler-rt/lib/msan/msan_linux.cc b/compiler-rt/lib/msan/msan_linux.cc
index aea29453c32..b51f6363310 100644
--- a/compiler-rt/lib/msan/msan_linux.cc
+++ b/compiler-rt/lib/msan/msan_linux.cc
@@ -51,6 +51,12 @@ bool InitShadow(bool prot1, bool prot2, bool map_shadow, bool init_origins) {
Printf("Bad1 : %p %p\n", kBad1Beg, kBad1End);
}
+ if (!MemoryRangeIsAvailable(kShadowBeg,
+ init_origins ? kOriginsEnd : kShadowEnd)) {
+ Printf("FATAL: Shadow memory range is not available.\n");
+ return false;
+ }
+
if (prot1 && !Mprotect(kBad1Beg, kBad1End - kBad1Beg))
return false;
if (prot2 && !Mprotect(kBad2Beg, kBad2End - kBad2Beg))
OpenPOWER on IntegriCloud