[compiler-rt] r318421 - [asan] Fix small X86_64 ShadowOffset for non-default shadow scale

Walter Lee via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 16 09:03:00 PST 2017


Author: waltl
Date: Thu Nov 16 09:03:00 2017
New Revision: 318421

URL: http://llvm.org/viewvc/llvm-project?rev=318421&view=rev
Log:
[asan] Fix small X86_64 ShadowOffset for non-default shadow scale

The requirement is that shadow memory must be aligned to page
boundaries (4k in this case).  Use a closed form equation that always
satisfies this requirement.

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

Modified:
    compiler-rt/trunk/lib/asan/asan_mapping.h

Modified: compiler-rt/trunk/lib/asan/asan_mapping.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_mapping.h?rev=318421&r1=318420&r2=318421&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_mapping.h (original)
+++ compiler-rt/trunk/lib/asan/asan_mapping.h Thu Nov 16 09:03:00 2017
@@ -139,7 +139,8 @@ static const u64 kDefaultShadowScale = 3
 static const u64 kDefaultShadowSentinel = ~(uptr)0;
 static const u64 kDefaultShadowOffset32 = 1ULL << 29;  // 0x20000000
 static const u64 kDefaultShadowOffset64 = 1ULL << 44;
-static const u64 kDefaultShort64bitShadowOffset = 0x7FFF8000;  // < 2G.
+static const u64 kDefaultShort64bitShadowOffset =
+    0x7FFFFFFF & (~0xFFFULL << kDefaultShadowScale);  // < 2G.
 static const u64 kIosShadowOffset32 = 1ULL << 30;  // 0x40000000
 static const u64 kIosShadowOffset64 = 0x120200000;
 static const u64 kIosSimShadowOffset32 = 1ULL << 30;




More information about the llvm-commits mailing list