summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorWalter Lee <waltl@google.com>2017-11-16 17:03:00 +0000
committerWalter Lee <waltl@google.com>2017-11-16 17:03:00 +0000
commit8edbfabe4d65e749511f8afbc80558059cf34dd7 (patch)
treec060f2b94c7cbddc17a4d3afe35cee926b9db976 /lib
parentc6d23c19b261eafb480fc8e92861383a54ba65cf (diff)
[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
Diffstat (limited to 'lib')
-rw-r--r--lib/asan/asan_mapping.h3
1 files changed, 2 insertions, 1 deletions
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;