From b50fb58695b4fa2b60e0003980b158a717638180 Mon Sep 17 00:00:00 2001 From: Leonard Chan Date: Fri, 9 Jul 2021 15:17:35 -0700 Subject: [PATCH] [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 --- compiler-rt/lib/hwasan/hwasan_fuchsia.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/compiler-rt/lib/hwasan/hwasan_fuchsia.cpp b/compiler-rt/lib/hwasan/hwasan_fuchsia.cpp index e61f6ada72fc..e875395c920f 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; }