diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2015-06-19 01:52:55 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2015-06-19 01:52:55 +0000 |
commit | 271d42ab6a140f9bb897a49a6aa8627356890aa0 (patch) | |
tree | 58bd6c8432448d07f4f423d4b5aa9b2618212143 /lib/ubsan/ubsan_handlers_cxx.h | |
parent | 7346ebc566c8a9394569951cfaf308eadb200564 (diff) | |
download | compiler-rt-271d42ab6a140f9bb897a49a6aa8627356890aa0.tar.gz |
Add control flow integrity diagnosis function to UBSan runtime library.
Also includes execution tests for the feature.
Differential Revision: http://reviews.llvm.org/D10269
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@240111 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ubsan/ubsan_handlers_cxx.h')
-rw-r--r-- | lib/ubsan/ubsan_handlers_cxx.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/ubsan/ubsan_handlers_cxx.h b/lib/ubsan/ubsan_handlers_cxx.h index cb1bca78b..92050d99e 100644 --- a/lib/ubsan/ubsan_handlers_cxx.h +++ b/lib/ubsan/ubsan_handlers_cxx.h @@ -25,6 +25,12 @@ struct DynamicTypeCacheMissData { unsigned char TypeCheckKind; }; +struct CFIBadTypeData { + SourceLocation Loc; + const TypeDescriptor &Type; + unsigned char TypeCheckKind; +}; + /// \brief Handle a runtime type check failure, caused by an incorrect vptr. /// When this handler is called, all we know is that the type was not in the /// cache; this does not necessarily imply the existence of a bug. @@ -35,6 +41,13 @@ extern "C" SANITIZER_INTERFACE_ATTRIBUTE void __ubsan_handle_dynamic_type_cache_miss_abort( DynamicTypeCacheMissData *Data, ValueHandle Pointer, ValueHandle Hash); +/// \brief Handle a control flow integrity check failure by printing a +/// diagnostic. +extern "C" SANITIZER_INTERFACE_ATTRIBUTE void +__ubsan_handle_cfi_bad_type(CFIBadTypeData *Data, ValueHandle Vtable); +extern "C" SANITIZER_INTERFACE_ATTRIBUTE void +__ubsan_handle_cfi_bad_type_abort(CFIBadTypeData *Data, ValueHandle Vtable); + } #endif // UBSAN_HANDLERS_H |