[compiler-rt] 8f1ea2e - [TSan][Darwin] Fix CheckAndProtect() for MappingAppleAarch64

Julian Lettner via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 15 18:04:06 PST 2021


Author: Julian Lettner
Date: 2021-12-15T18:03:58-08:00
New Revision: 8f1ea2e85ca64dd706824fb7f5ea15c678a15dde

URL: https://github.com/llvm/llvm-project/commit/8f1ea2e85ca64dd706824fb7f5ea15c678a15dde
DIFF: https://github.com/llvm/llvm-project/commit/8f1ea2e85ca64dd706824fb7f5ea15c678a15dde.diff

LOG: [TSan][Darwin] Fix CheckAndProtect() for MappingAppleAarch64

In the new TSan runtime refactoring this line was changed:
```
ProtectRange(MetaShadowEnd(), TraceMemBeg());
-->
ProtectRange(MetaShadowEnd(), HeapMemBeg());
```

But for `MappingAppleAarch64` the app heap comes before the shadow,
resulting in:
```
CHECK failed: tsan_platform_posix.cpp:83 "((beg)) <= ((end))" (0xe00000000, 0x200000000)
```

rdar://86521924

Differential Revision: https://reviews.llvm.org/D115834

Added: 
    

Modified: 
    compiler-rt/lib/tsan/rtl/tsan_platform_posix.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/tsan/rtl/tsan_platform_posix.cpp b/compiler-rt/lib/tsan/rtl/tsan_platform_posix.cpp
index 763a533de525b..cc9c7b2b74375 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_platform_posix.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_platform_posix.cpp
@@ -113,7 +113,7 @@ void CheckAndProtect() {
 #    if defined(__aarch64__) && defined(__APPLE__) && SANITIZER_IOS
   ProtectRange(HeapMemEnd(), ShadowBeg());
   ProtectRange(ShadowEnd(), MetaShadowBeg());
-  ProtectRange(MetaShadowEnd(), HeapMemBeg());
+  ProtectRange(MetaShadowEnd(), HiAppMemBeg());
 #    else
   ProtectRange(LoAppMemEnd(), ShadowBeg());
   ProtectRange(ShadowEnd(), MetaShadowBeg());


        


More information about the llvm-commits mailing list