tsan: make windows shadow mapping a bijection

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

llvm-svn: 267713
This commit is contained in:
Dmitry Vyukov 2016-04-27 13:34:01 +00:00
parent 02e98331c0
commit 3e0315c044
1 changed files with 4 additions and 1 deletions

View File

@ -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