summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib
diff options
context:
space:
mode:
authorJay Foad <jay.foad@gmail.com>2015-06-25 20:47:59 +0000
committerJay Foad <jay.foad@gmail.com>2015-06-25 20:47:59 +0000
commit198337bf4200dd9d33c6223fc8ce5a488e60187f (patch)
tree67ea9ace62c70ee33203be4be1dcee5ce00a7820 /compiler-rt/lib
parentf1ac0fcf563dcc8cdef37b2717767c5b60bf970b (diff)
downloadbcm5719-llvm-198337bf4200dd9d33c6223fc8ce5a488e60187f.tar.gz
bcm5719-llvm-198337bf4200dd9d33c6223fc8ce5a488e60187f.zip
[msan] Fix SetShadow for mappings at the end of the application address space
Summary: On PPC64 if you disable ASLR (or run under gdb) you're likely to see mmap returning a mapping right at the end of the application address space region. This caused SetShadow to call MEM_TO_SHADOW() on the last+1 address in the region, which seems wrong to me; how can MEM_TO_SHADOW() distinguish this from the first address in the following region? Fixed by only calling MEM_TO_SHADOW() once, on the start address. Reviewers: samsonov, wschmidt, eugenis Reviewed By: eugenis Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10735 llvm-svn: 240690
Diffstat (limited to 'compiler-rt/lib')
-rw-r--r--compiler-rt/lib/msan/msan_poisoning.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler-rt/lib/msan/msan_poisoning.cc b/compiler-rt/lib/msan/msan_poisoning.cc
index 96411fdbc31..92134f6a15b 100644
--- a/compiler-rt/lib/msan/msan_poisoning.cc
+++ b/compiler-rt/lib/msan/msan_poisoning.cc
@@ -122,7 +122,7 @@ void CopyMemory(void *dst, const void *src, uptr size, StackTrace *stack) {
void SetShadow(const void *ptr, uptr size, u8 value) {
uptr PageSize = GetPageSizeCached();
uptr shadow_beg = MEM_TO_SHADOW(ptr);
- uptr shadow_end = MEM_TO_SHADOW((uptr)ptr + size);
+ uptr shadow_end = shadow_beg + size;
if (value ||
shadow_end - shadow_beg < common_flags()->clear_shadow_mmap_threshold) {
REAL(memset)((void *)shadow_beg, value, shadow_end - shadow_beg);
OpenPOWER on IntegriCloud