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

Kumar Sukhani kumarsukhani at gmail.com
Sun May 10 10:46:07 PDT 2015


Hi pcc, kcc,

LLVM patch to add support of AArch64 for DFSan in Compiler-rt library

REPOSITORY
  rL LLVM

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,22 @@
 /// address into the shadow memory range.  See the function
 /// DataFlowSanitizer::getShadowAddress below.
 ///
+/// On Linux/MIPS64 and Linux/AArch64, 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
+///
 /// For more information, please refer to the design document:
 /// http://clang.llvm.org/docs/DataFlowSanitizerDesign.html
 
@@ -420,6 +436,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();
 
@@ -432,7 +449,7 @@
   ShadowPtrMul = ConstantInt::getSigned(IntptrTy, ShadowWidth / 8);
   if (IsX86_64)
     ShadowPtrMask = ConstantInt::getSigned(IntptrTy, ~0x700000000000LL);
-  else if (IsMIPS64)
+  else if (IsMIPS64 || IsAArch64)
     ShadowPtrMask = ConstantInt::getSigned(IntptrTy, ~0xF000000000LL);
   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.25436.patch
Type: text/x-patch
Size: 1806 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150510/1aaec50b/attachment.bin>


More information about the llvm-commits mailing list