[compiler-rt] r245841 - [dfsan] Enable DFSan for AArch64/42-bit VMA
Adhemerval Zanella via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 24 06:50:14 PDT 2015
Author: azanella
Date: Mon Aug 24 08:50:14 2015
New Revision: 245841
URL: http://llvm.org/viewvc/llvm-project?rev=245841&view=rev
Log:
[dfsan] Enable DFSan for AArch64/42-bit VMA
This patch adds support for dfsan on aarch64-linux with 42-bit VMA
(current default config for 64K pagesize kernels). The support is
enabled by defining the SANITIZER_AARCH64_VMA to 42 at build time
for both clang/llvm and compiler-rt. The default VMA is 39 bits.
Modified:
compiler-rt/trunk/lib/dfsan/dfsan.cc
compiler-rt/trunk/lib/dfsan/dfsan.h
Modified: compiler-rt/trunk/lib/dfsan/dfsan.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/dfsan/dfsan.cc?rev=245841&r1=245840&r2=245841&view=diff
==============================================================================
--- compiler-rt/trunk/lib/dfsan/dfsan.cc (original)
+++ compiler-rt/trunk/lib/dfsan/dfsan.cc Mon Aug 24 08:50:14 2015
@@ -96,6 +96,22 @@ SANITIZER_INTERFACE_ATTRIBUTE THREADLOCA
// | reserved by kernel |
// +--------------------+ 0x0000000000
+// On Linux/AArch64 (42-bit VMA), memory is laid out as follow:
+//
+// +--------------------+ 0x40000000000 (top of memory)
+// | application memory |
+// +--------------------+ 0x3ff00008000 (kAppAddr)
+// | |
+// | unused |
+// | |
+// +--------------------+ 0x1200000000 (kUnusedAddr)
+// | union table |
+// +--------------------+ 0x8000000000 (kUnionTableAddr)
+// | shadow memory |
+// +--------------------+ 0x0000010000 (kShadowAddr)
+// | reserved by kernel |
+// +--------------------+ 0x0000000000
+
typedef atomic_dfsan_label dfsan_union_table_t[kNumLabels][kNumLabels];
#if defined(__x86_64__)
@@ -110,9 +126,17 @@ static const uptr kUnusedAddr = kUnionTa
static const uptr kAppAddr = 0xF000008000;
#elif defined(__aarch64__)
static const uptr kShadowAddr = 0x10000;
+# if SANITIZER_AARCH64_VMA == 39
static const uptr kUnionTableAddr = 0x1000000000;
+# elif SANITIZER_AARCH64_VMA == 42
+static const uptr kUnionTableAddr = 0x8000000000;
+# endif
static const uptr kUnusedAddr = kUnionTableAddr + sizeof(dfsan_union_table_t);
+# if SANITIZER_AARCH64_VMA == 39
static const uptr kAppAddr = 0x7000008000;
+# elif SANITIZER_AARCH64_VMA == 42
+static const uptr kAppAddr = 0x3ff00008000;
+# endif
#else
# error "DFSan not supported for this platform!"
#endif
Modified: compiler-rt/trunk/lib/dfsan/dfsan.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/dfsan/dfsan.h?rev=245841&r1=245840&r2=245841&view=diff
==============================================================================
--- compiler-rt/trunk/lib/dfsan/dfsan.h (original)
+++ compiler-rt/trunk/lib/dfsan/dfsan.h Mon Aug 24 08:50:14 2015
@@ -49,7 +49,11 @@ inline dfsan_label *shadow_for(void *ptr
#elif defined(__mips64)
return (dfsan_label *) ((((uptr) ptr) & ~0xF000000000) << 1);
#elif defined(__aarch64__)
+# if SANITIZER_AARCH64_VMA == 39
return (dfsan_label *) ((((uptr) ptr) & ~0x7800000000) << 1);
+# elif SANITIZER_AARCH64_VMA == 42
+ return (dfsan_label *) ((((uptr) ptr) & ~0x3c000000000) << 1);
+# endif
#endif
}
More information about the llvm-commits
mailing list