diff options
author | Walter Lee <waltl@google.com> | 2017-11-16 22:02:58 +0000 |
---|---|---|
committer | Walter Lee <waltl@google.com> | 2017-11-16 22:02:58 +0000 |
commit | 9bf73b7c576069750b5018f08a8fd457ef9f995b (patch) | |
tree | 65116de51adc6ce23de706be169e511bc2d7b93f | |
parent | 54282d766f2944d6df0576907ef29dbb180b4ee2 (diff) |
[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
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@318460 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/asan/asan_fake_stack.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/asan/asan_fake_stack.cc b/lib/asan/asan_fake_stack.cc index 6a064aaa1..1c6184e3c 100644 --- a/lib/asan/asan_fake_stack.cc +++ b/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<u64*>(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. |