[PATCH] [LLVM] [AArch64] [DFSan] Adding support of AArch64 for DFSan

Kumar Sukhani kumarsukhani at gmail.com
Tue May 12 03:51:25 PDT 2015


Considering AArch64 has only 39 bit addressable.


http://reviews.llvm.org/D9650

Files:
  lib/Transforms/Instrumentation/DataFlowSanitizer.cpp

Index: lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
===================================================================
--- lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
+++ lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
@@ -41,6 +41,39 @@
 /// address into the shadow memory range.  See the function
 /// DataFlowSanitizer::getShadowAddress below.
 ///
+
+/// On Linux/MIPS64, memory is laid out as follows:
+///
+/// +--------------------+ 0x10000000000 (top of memory)
+/// | application memory |
+/// +--------------------+ 0xF000008000 (kAppAddr)
+/// |                    |
+/// |       unused       |
+/// |                    |
+/// +--------------------+ 0x2200000000 (kUnusedAddr)
+/// |    union table     |
+/// +--------------------+ 0x2000000000 (kUnionTableAddr)
+/// |   shadow memory    |
+/// +--------------------+ 0x0000010000 (kShadowAddr)
+/// | reserved by kernel |
+/// +--------------------+ 0x0000000000
+
+/// On Linux/AArch64, memory is laid out as follows:
+///
+/// +--------------------+ 0x8000000000 (top of memory)
+/// | application memory |
+/// +--------------------+ 0x7000008000 (kAppAddr)
+/// |                    |
+/// |       unused       |
+/// |                    |
+/// +--------------------+ 0x2200000000 (kUnusedAddr)
+/// |    union table     |
+/// +--------------------+ 0x2000000000 (kUnionTableAddr)
+/// |   shadow memory    |
+/// +--------------------+ 0x0000010000 (kShadowAddr)
+/// | reserved by kernel |
+/// +--------------------+ 0x0000000000
+
 /// For more information, please refer to the design document:
 /// http://clang.llvm.org/docs/DataFlowSanitizerDesign.html
 
@@ -420,6 +453,7 @@
   bool IsX86_64 = TargetTriple.getArch() == llvm::Triple::x86_64;
   bool IsMIPS64 = TargetTriple.getArch() == llvm::Triple::mips64 ||
                   TargetTriple.getArch() == llvm::Triple::mips64el;
+  bool IsAArch64 = TargetTriple.getArch() == llvm::Triple::aarch64;
 
   const DataLayout &DL = M.getDataLayout();
 
@@ -434,6 +468,8 @@
     ShadowPtrMask = ConstantInt::getSigned(IntptrTy, ~0x700000000000LL);
   else if (IsMIPS64)
     ShadowPtrMask = ConstantInt::getSigned(IntptrTy, ~0xF000000000LL);
+  else if (IsAArch64)
+    ShadowPtrMask = ConstantInt::getSigned(IntptrTy, ~0x7000000000LL);
   else
     report_fatal_error("unsupported triple");

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9650.25571.patch
Type: text/x-patch
Size: 2339 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150512/7fa77862/attachment.bin>


More information about the llvm-commits mailing list