[compiler-rt] b50fb58 - [compiler-rt][hwasan][fuchsia] Define shadow bound globals

Leonard Chan via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 26 15:41:34 PDT 2021


Author: Leonard Chan
Date: 2021-07-26T15:40:45-07:00
New Revision: b50fb58695b4fa2b60e0003980b158a717638180

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

LOG: [compiler-rt][hwasan][fuchsia] Define shadow bound globals

These are required by MemIsShadow for checking if an address actually is shadow memory.

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

Added: 
    

Modified: 
    compiler-rt/lib/hwasan/hwasan_fuchsia.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/hwasan/hwasan_fuchsia.cpp b/compiler-rt/lib/hwasan/hwasan_fuchsia.cpp
index e61f6ada72fc4..e875395c920f4 100644
--- a/compiler-rt/lib/hwasan/hwasan_fuchsia.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_fuchsia.cpp
@@ -34,6 +34,15 @@ bool InitShadow() {
   __sanitizer::InitShadowBounds();
   CHECK_NE(__sanitizer::ShadowBounds.shadow_limit, 0);
 
+  // These variables are used by MemIsShadow for asserting we have a correct
+  // shadow address. On Fuchsia, we only have one region of shadow, so the
+  // bounds of Low shadow can be zero while High shadow represents the true
+  // bounds. Note that these are inclusive ranges.
+  kLowShadowStart = 0;
+  kLowShadowEnd = 0;
+  kHighShadowStart = __sanitizer::ShadowBounds.shadow_base;
+  kHighShadowEnd = __sanitizer::ShadowBounds.shadow_limit - 1;
+
   return true;
 }
 


        


More information about the llvm-commits mailing list