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");