[compiler-rt] r267713 - tsan: make windows shadow mapping a bijection

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 27 06:34:01 PDT 2016


Author: dvyukov
Date: Wed Apr 27 08:34:01 2016
New Revision: 267713

URL: http://llvm.org/viewvc/llvm-project?rev=267713&view=rev
Log:
tsan: make windows shadow mapping a bijection

CheckShadowMapping function started catching that
mem->shadow->mem mapping is not bijection.
Make it bijection.


Modified:
    compiler-rt/trunk/lib/tsan/rtl/tsan_platform.h

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_platform.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_platform.h?rev=267713&r1=267712&r2=267713&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_platform.h (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_platform.h Wed Apr 27 08:34:01 2016
@@ -587,7 +587,11 @@ uptr MemToShadowImpl(uptr x) {
   return (((x) & ~(Mapping::kAppMemMsk | (kShadowCell - 1)))
       ^ Mapping::kAppMemXor) * kShadowCnt;
 #else
+# ifndef SANITIZER_WINDOWS
   return ((x & ~(kShadowCell - 1)) * kShadowCnt) | Mapping::kShadowBeg;
+# else
+  return ((x & ~(kShadowCell - 1)) * kShadowCnt) + Mapping::kShadowBeg;
+# endif
 #endif
 }
 
@@ -662,7 +666,6 @@ uptr ShadowToMemImpl(uptr s) {
 # ifndef SANITIZER_WINDOWS
   return (s & ~Mapping::kShadowBeg) / kShadowCnt;
 # else
-  // FIXME(dvyukov): this is most likely wrong as the mapping is not bijection.
   return (s - Mapping::kShadowBeg) / kShadowCnt;
 # endif // SANITIZER_WINDOWS
 #endif




More information about the llvm-commits mailing list