[dfsan] Add runtime function for aborting on indirect calls to

uninstrumented vararg functions.

llvm-svn: 221364
This commit is contained in:
Peter Collingbourne
2014-11-05 17:21:11 +00:00
parent 4da39395b0
commit f20091118c
2 changed files with 33 additions and 0 deletions

View File

@@ -147,6 +147,15 @@ extern "C" SANITIZER_INTERFACE_ATTRIBUTE void __dfsan_nonzero_label() {
Report("WARNING: DataFlowSanitizer: saw nonzero label\n");
}
// Indirect call to an uninstrumented vararg function. We don't have a way of
// handling these at the moment.
extern "C" SANITIZER_INTERFACE_ATTRIBUTE void
__dfsan_vararg_wrapper(const char *fname) {
Report("FATAL: DataFlowSanitizer: unsupported indirect call to vararg "
"function %s\n", fname);
Die();
}
// Like __dfsan_union, but for use from the client or custom functions. Hence
// the equality comparison is done here before calling __dfsan_union.
SANITIZER_INTERFACE_ATTRIBUTE dfsan_label

View File

@@ -0,0 +1,24 @@
// RUN: %clang_dfsan -m64 %s -o %t
// RUN: not %run %t 2>&1 | FileCheck %s
// RUN: %run %t foo
// RUN: %clang_dfsan -mllvm -dfsan-args-abi -m64 %s -o %t
// RUN: not %run %t 2>&1 | FileCheck %s
// RUN: %run %t foo
#include <stdio.h>
int do_nothing(const char *format, ...) {
return 0;
}
int main(int argc, char **argv) {
int (*fp)(const char *, ...);
if (argc > 1)
fp = do_nothing;
else
fp = printf;
// CHECK: FATAL: DataFlowSanitizer: unsupported indirect call to vararg function printf
fp("hello %s\n", "world");
}