[PATCH] D12236: [compiler-rt] [asan] Enable DFSan for AArch64/42-bit VMA

Adhemerval Zanella via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 21 06:38:23 PDT 2015


zatrazz created this revision.
zatrazz added reviewers: rengolin, kcc, eugenis, dvyukov.
zatrazz added a subscriber: llvm-commits.
Herald added subscribers: rengolin, aemerson.

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.

http://reviews.llvm.org/D12236

Files:
  lib/dfsan/dfsan.cc
  lib/dfsan/dfsan.h

Index: lib/dfsan/dfsan.h
===================================================================
--- lib/dfsan/dfsan.h
+++ lib/dfsan/dfsan.h
@@ -49,7 +49,11 @@
 #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
 }
 
Index: lib/dfsan/dfsan.cc
===================================================================
--- lib/dfsan/dfsan.cc
+++ lib/dfsan/dfsan.cc
@@ -96,6 +96,22 @@
 // | 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     |
+// +--------------------+ 0x1000000000 (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 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12236.32823.patch
Type: text/x-patch
Size: 2029 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150821/c8d62b21/attachment.bin>


More information about the llvm-commits mailing list