From 8edbfabe4d65e749511f8afbc80558059cf34dd7 Mon Sep 17 00:00:00 2001 From: Walter Lee Date: Thu, 16 Nov 2017 17:03:00 +0000 Subject: [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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@318421 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/asan/asan_mapping.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/asan/asan_mapping.h b/lib/asan/asan_mapping.h index c1e965c7a..c51c960c5 100644 --- a/lib/asan/asan_mapping.h +++ b/lib/asan/asan_mapping.h @@ -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; -- cgit v1.2.3