summaryrefslogtreecommitdiffstats
path: root/llvm/test/Instrumentation/DataFlowSanitizer/prefix-rename.ll
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2013-08-22 20:08:08 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2013-08-22 20:08:08 +0000
commit59b1262d012e0ed8ac3ef51f6abd15d5876ae148 (patch)
tree20d1c1c73463a9c99d3737400381628f503d0e40 /llvm/test/Instrumentation/DataFlowSanitizer/prefix-rename.ll
parent3738445cdd4da3452d04fc09a8f5191267f6f706 (diff)
downloadbcm5719-llvm-59b1262d012e0ed8ac3ef51f6abd15d5876ae148.tar.gz
bcm5719-llvm-59b1262d012e0ed8ac3ef51f6abd15d5876ae148.zip
DataFlowSanitizer: Prefix the name of each instrumented function with "dfs$".
DFSan changes the ABI of each function in the module. This makes it possible for a function with the native ABI to be called with the instrumented ABI, or vice versa, thus possibly invoking undefined behavior. A simple way of statically detecting instances of this problem is to prepend the prefix "dfs$" to the name of each instrumented-ABI function. This will not catch every such problem; in particular function pointers passed across the instrumented-native barrier cannot be used on the other side. These problems could potentially be caught dynamically. Differential Revision: http://llvm-reviews.chandlerc.com/D1373 llvm-svn: 189052
Diffstat (limited to 'llvm/test/Instrumentation/DataFlowSanitizer/prefix-rename.ll')
-rw-r--r--llvm/test/Instrumentation/DataFlowSanitizer/prefix-rename.ll14
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/test/Instrumentation/DataFlowSanitizer/prefix-rename.ll b/llvm/test/Instrumentation/DataFlowSanitizer/prefix-rename.ll
new file mode 100644
index 00000000000..1a5646074d2
--- /dev/null
+++ b/llvm/test/Instrumentation/DataFlowSanitizer/prefix-rename.ll
@@ -0,0 +1,14 @@
+; RUN: opt < %s -dfsan -S | FileCheck %s
+; RUN: opt < %s -dfsan -dfsan-args-abi -S | FileCheck %s
+target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
+
+; CHECK: module asm ".symver dfs$f1,dfs$f@@version1"
+module asm ".symver f1,f@@version1"
+
+; CHECK: @"dfs$f2" = alias {{.*}} @"dfs$f1"
+@f2 = alias void ()* @f1
+
+; CHECK: define void @"dfs$f1"
+define void @f1() {
+ ret void
+}
OpenPOWER on IntegriCloud