[compiler-rt] r318460 - [asan] Avoid assert failure for non-default shadow scale
Walter Lee via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 16 14:02:58 PST 2017
Author: waltl
Date: Thu Nov 16 14:02:58 2017
New Revision: 318460
URL: http://llvm.org/viewvc/llvm-project?rev=318460&view=rev
Log:
[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
Modified:
compiler-rt/trunk/lib/asan/asan_fake_stack.cc
Modified: compiler-rt/trunk/lib/asan/asan_fake_stack.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_fake_stack.cc?rev=318460&r1=318459&r2=318460&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_fake_stack.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_fake_stack.cc Thu Nov 16 14:02:58 2017
@@ -28,9 +28,9 @@ static const u64 kAllocaRedzoneMask = 31
// 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.
More information about the llvm-commits
mailing list