summaryrefslogtreecommitdiff
path: root/lib/asan/asan_mapping.h
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2012-05-12 12:33:10 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2012-05-12 12:33:10 +0000
commit3972ea03aa52d81ca324945ba94eea22d403df12 (patch)
treef0f0b4e253f8c3d9956ffcbb41c0be6f01c87f30 /lib/asan/asan_mapping.h
parent1b2d44c0473e84bc43514c1f3adc0ed30f297ebd (diff)
Fix GetFrameNameByAddr hitting stale stack guards.
In the current implementation AsanThread::GetFrameNameByAddr scans the stack for a magic guard value to locate base address of the stack frame. This is not reliable, especially on ARM, where the code that stores this magic value has to construct it in a register from two small intermediates; this register can then end up stored in a random stack location in the prologue of another function. With this change, GetFrameNameByAddr scans the shadow memory for the signature of a left stack redzone instead. It is now possible to remove the magic from the instrumentation pass for additional performance gain. We keep it there for now just to make sure the new algorithm does not fail in some corner case. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@156710 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/asan/asan_mapping.h')
-rw-r--r--lib/asan/asan_mapping.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/asan/asan_mapping.h b/lib/asan/asan_mapping.h
index 4824bf109..3912484c8 100644
--- a/lib/asan/asan_mapping.h
+++ b/lib/asan/asan_mapping.h
@@ -35,6 +35,7 @@ extern __attribute__((visibility("default"))) uintptr_t __asan_mapping_offset;
#define SHADOW_GRANULARITY (1ULL << SHADOW_SCALE)
#define MEM_TO_SHADOW(mem) (((mem) >> SHADOW_SCALE) | (SHADOW_OFFSET))
+#define SHADOW_TO_MEM(shadow) (((shadow) - SHADOW_OFFSET) << SHADOW_SCALE)
#if __WORDSIZE == 64
static const size_t kHighMemEnd = 0x00007fffffffffffUL;