[llvm] r245840 - [sanitizers] Add DFSan support for AArch64 42-bit VMA
Adhemerval Zanella via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 24 06:48:10 PDT 2015
Author: azanella
Date: Mon Aug 24 08:48:10 2015
New Revision: 245840
URL: http://llvm.org/viewvc/llvm-project?rev=245840&view=rev
Log:
[sanitizers] Add DFSan support 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:
llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
Modified: llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp?rev=245840&r1=245839&r2=245840&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp Mon Aug 24 08:48:10 2015
@@ -72,6 +72,16 @@
using namespace llvm;
+// VMA size definition for architecture that support multiple sizes.
+// AArch64 has 3 VMA sizes: 39, 42 and 48.
+#ifndef SANITIZER_AARCH64_VMA
+# define SANITIZER_AARCH64_VMA 39
+#else
+# if SANITIZER_AARCH64_VMA != 39 && SANITIZER_AARCH64_VMA != 42
+# error "invalid SANITIZER_AARCH64_VMA size"
+# endif
+#endif
+
// The -dfsan-preserve-alignment flag controls whether this pass assumes that
// alignment requirements provided by the input IR are correct. For example,
// if the input IR contains a load with alignment 8, this flag will cause
@@ -437,7 +447,11 @@ bool DataFlowSanitizer::doInitialization
else if (IsMIPS64)
ShadowPtrMask = ConstantInt::getSigned(IntptrTy, ~0xF000000000LL);
else if (IsAArch64)
+#if SANITIZER_AARCH64_VMA == 39
ShadowPtrMask = ConstantInt::getSigned(IntptrTy, ~0x7800000000LL);
+#else
+ ShadowPtrMask = ConstantInt::getSigned(IntptrTy, ~0x3c000000000LL);
+#endif
else
report_fatal_error("unsupported triple");
More information about the llvm-commits
mailing list