[compiler-rt] r337550 - esan: fix shadow setup

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 20 06:40:08 PDT 2018


Author: dvyukov
Date: Fri Jul 20 06:40:08 2018
New Revision: 337550

URL: http://llvm.org/viewvc/llvm-project?rev=337550&view=rev
Log:
esan: fix shadow setup

r337531 changed return type of MmapFixedNoReserve, but esan wasn't updated.
As the result esan shadow setup always fails.
We probably need to make MmapFixedNoAccess signature consistent
with MmapFixedNoReserve. But this is just to unbreak tests.
 

Modified:
    compiler-rt/trunk/lib/esan/esan.cpp

Modified: compiler-rt/trunk/lib/esan/esan.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/esan/esan.cpp?rev=337550&r1=337549&r2=337550&view=diff
==============================================================================
--- compiler-rt/trunk/lib/esan/esan.cpp (original)
+++ compiler-rt/trunk/lib/esan/esan.cpp Fri Jul 20 06:40:08 2018
@@ -163,15 +163,15 @@ static void initializeShadow() {
     VPrintf(1, "Shadow #%d: [%zx-%zx) (%zuGB)\n", i, ShadowStart, ShadowEnd,
             (ShadowEnd - ShadowStart) >> 30);
 
-    uptr Map;
+    uptr Map = 0;
     if (__esan_which_tool == ESAN_WorkingSet) {
       // We want to identify all shadow pages that are touched so we start
       // out inaccessible.
       Map = (uptr)MmapFixedNoAccess(ShadowStart, ShadowEnd- ShadowStart,
                                     "shadow");
     } else {
-      Map = (uptr)MmapFixedNoReserve(ShadowStart, ShadowEnd - ShadowStart,
-                                     "shadow");
+      if (MmapFixedNoReserve(ShadowStart, ShadowEnd - ShadowStart, "shadow"))
+        Map = ShadowStart;
     }
     if (Map != ShadowStart) {
       Printf("FATAL: EfficiencySanitizer failed to map its shadow memory.\n");




More information about the llvm-commits mailing list