Implement diagnostic mode for -fsanitize=cfi*, -fsanitize=cfi-diag.
authorPeter Collingbourne <peter@pcc.me.uk>
Fri, 19 Jun 2015 01:51:54 +0000 (01:51 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Fri, 19 Jun 2015 01:51:54 +0000 (01:51 +0000)
commit6708c4a1767d44a4d25938b07f8f144a906fb411
treea669e81facf705913b7aadb42b0e112be99a6557
parent2a567835d1a77150634800247c864f12ca836f2b
Implement diagnostic mode for -fsanitize=cfi*, -fsanitize=cfi-diag.

This causes programs compiled with this flag to print a diagnostic when
a control flow integrity check fails instead of aborting. Diagnostics are
printed using UBSan's runtime library.

The main motivation of this feature over -fsanitize=vptr is fidelity with
the -fsanitize=cfi implementation: the diagnostics are printed under exactly
the same conditions as those which would cause -fsanitize=cfi to abort the
program. This means that the same restrictions apply regarding compiling
all translation units with -fsanitize=cfi, cross-DSO virtual calls are
forbidden, etc.

Differential Revision: http://reviews.llvm.org/D10268

llvm-svn: 240109
12 files changed:
clang/docs/UsersManual.rst
clang/lib/CodeGen/CGCXXABI.h
clang/lib/CodeGen/CGClass.cpp
clang/lib/CodeGen/CGExpr.cpp
clang/lib/CodeGen/CGExprCXX.cpp
clang/lib/CodeGen/CGExprScalar.cpp
clang/lib/CodeGen/CodeGenFunction.h
clang/lib/CodeGen/ItaniumCXXABI.cpp
clang/lib/CodeGen/MicrosoftCXXABI.cpp
clang/lib/Driver/SanitizerArgs.cpp
clang/test/CodeGenCXX/cfi-cast.cpp
clang/test/CodeGenCXX/cfi-vcall.cpp