From ed8b52c8bc585e4fb76ac43bdafb4e07b02036ae Mon Sep 17 00:00:00 2001 From: Walter Lee Date: Thu, 16 Nov 2017 22:02:58 +0000 Subject: [PATCH] [asan] Avoid assert failure for non-default shadow scale Rather than assertion failing, we can fall back to the non-optimized version which works for any shadow scale. Differential Revision: https://reviews.llvm.org/D39474 llvm-svn: 318460 --- compiler-rt/lib/asan/asan_fake_stack.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler-rt/lib/asan/asan_fake_stack.cc b/compiler-rt/lib/asan/asan_fake_stack.cc index 6a064aa..1c6184e 100644 --- a/compiler-rt/lib/asan/asan_fake_stack.cc +++ b/compiler-rt/lib/asan/asan_fake_stack.cc @@ -28,9 +28,9 @@ static const u64 kAllocaRedzoneMask = 31UL; // For small size classes inline PoisonShadow for better performance. ALWAYS_INLINE void SetShadow(uptr ptr, uptr size, uptr class_id, u64 magic) { - CHECK_EQ(SHADOW_SCALE, 3); // This code expects SHADOW_SCALE=3. u64 *shadow = reinterpret_cast(MemToShadow(ptr)); - if (class_id <= 6) { + if (SHADOW_SCALE == 3 && class_id <= 6) { + // This code expects SHADOW_SCALE=3. for (uptr i = 0; i < (((uptr)1) << class_id); i++) { shadow[i] = magic; // Make sure this does not become memset. -- 2.7.4