summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2015-08-24 13:48:10 +0000
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2015-08-24 13:48:10 +0000
commit4754e2d59c20f0ba43336a0e5d20c8ee06949a6a (patch)
tree0d616abe36f29a3d1c08b48a1d30d049b89d8624 /llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
parent0f4b17d12c8852a96525e4acdb09dd262b4f27d3 (diff)
downloadbcm5719-llvm-4754e2d59c20f0ba43336a0e5d20c8ee06949a6a.tar.gz
bcm5719-llvm-4754e2d59c20f0ba43336a0e5d20c8ee06949a6a.zip
[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. llvm-svn: 245840
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp')
-rw-r--r--llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
index 8344e087a95..c613f2577a6 100644
--- a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
@@ -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(Module &M) {
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");
OpenPOWER on IntegriCloud