From e31eca900a1f8849af75100c2d92e838d79d0920 Mon Sep 17 00:00:00 2001 From: Kostya Serebryany Date: Fri, 15 Feb 2013 12:00:24 +0000 Subject: [asan] make asan work with 7fff8000 offset and prelink When prelink is installed in the system, prelink-ed libraries map between 0x003000000000 and 0x004000000000 thus occupying the shadow Gap, so we need so split the address space even further, like this: || [0x10007fff8000, 0x7fffffffffff] || HighMem || || [0x02008fff7000, 0x10007fff7fff] || HighShadow || || [0x004000000000, 0x02008fff6fff] || ShadowGap3 || || [0x003000000000, 0x003fffffffff] || MidMem || || [0x00087fff8000, 0x002fffffffff] || ShadowGap2 || || [0x00067fff8000, 0x00087fff7fff] || MidShadow || || [0x00008fff7000, 0x00067fff7fff] || ShadowGap || || [0x00007fff8000, 0x00008fff6fff] || LowShadow || || [0x000000000000, 0x00007fff7fff] || LowMem || Do it only if necessary. Also added a bit of profiling code to make sure that the mapping code is efficient. Added a lit test to simulate prelink-ed libraries. Unfortunately, this test does not work with binutils-gold linker. If gold is the default linker the test silently passes. Also replaced __has_feature(address_sanitizer) with __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__) in two places. Patch partially by Jakub Jelinek. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@175263 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/sanitizer/asan_interface.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/sanitizer/asan_interface.h') diff --git a/include/sanitizer/asan_interface.h b/include/sanitizer/asan_interface.h index 04794a41b..8adf3f17f 100644 --- a/include/sanitizer/asan_interface.h +++ b/include/sanitizer/asan_interface.h @@ -37,8 +37,8 @@ extern "C" { // (un)poison memory in the same memory region simultaneously. void __asan_unpoison_memory_region(void const volatile *addr, size_t size); - // User code should use macro instead of functions. -#if __has_feature(address_sanitizer) +// User code should use macros instead of functions. +#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__) #define ASAN_POISON_MEMORY_REGION(addr, size) \ __asan_poison_memory_region((addr), (size)) #define ASAN_UNPOISON_MEMORY_REGION(addr, size) \ -- cgit v1.2.3