ubsan_handlers_cxx.h revision 1.1.1.2
1//===-- ubsan_handlers_cxx.h ------------------------------------*- C++ -*-===// 2// 3// This file is distributed under the University of Illinois Open Source 4// License. See LICENSE.TXT for details. 5// 6//===----------------------------------------------------------------------===// 7// 8// Entry points to the runtime library for Clang's undefined behavior sanitizer, 9// for C++-specific checks. This code is not linked into C binaries. 10// 11//===----------------------------------------------------------------------===// 12#ifndef UBSAN_HANDLERS_CXX_H 13#define UBSAN_HANDLERS_CXX_H 14 15#include "ubsan_value.h" 16 17namespace __ubsan { 18 19struct DynamicTypeCacheMissData { 20 SourceLocation Loc; 21 const TypeDescriptor &Type; 22 void *TypeInfo; 23 unsigned char TypeCheckKind; 24}; 25 26struct CFIBadTypeData { 27 SourceLocation Loc; 28 const TypeDescriptor &Type; 29 unsigned char TypeCheckKind; 30}; 31 32/// \brief Handle a runtime type check failure, caused by an incorrect vptr. 33/// When this handler is called, all we know is that the type was not in the 34/// cache; this does not necessarily imply the existence of a bug. 35extern "C" SANITIZER_INTERFACE_ATTRIBUTE 36void __ubsan_handle_dynamic_type_cache_miss( 37 DynamicTypeCacheMissData *Data, ValueHandle Pointer, ValueHandle Hash); 38extern "C" SANITIZER_INTERFACE_ATTRIBUTE 39void __ubsan_handle_dynamic_type_cache_miss_abort( 40 DynamicTypeCacheMissData *Data, ValueHandle Pointer, ValueHandle Hash); 41 42/// \brief Handle a control flow integrity check failure by printing a 43/// diagnostic. 44extern "C" SANITIZER_INTERFACE_ATTRIBUTE void 45__ubsan_handle_cfi_bad_type(CFIBadTypeData *Data, ValueHandle Vtable); 46extern "C" SANITIZER_INTERFACE_ATTRIBUTE void 47__ubsan_handle_cfi_bad_type_abort(CFIBadTypeData *Data, ValueHandle Vtable); 48 49} 50 51#endif // UBSAN_HANDLERS_H 52