Crashpad
 
Loading...
Searching...
No Matches
crashpad::NoCfiIcall< Functor > Class Template Reference

Disables cfi-icall for calls made through a function pointer. More...

#include "util/misc/no_cfi_icall.h"

Public Member Functions

 NoCfiIcall (Functor function)
 Constructs this object.
 
 NoCfiIcall ()
 
template<typename PointerType, typename = std::enable_if_t< std::is_same<typename std::remove_cv<PointerType>::type, void*>::value>>
 NoCfiIcall (PointerType function)
 
void SetPointer (Functor function)
 Updates the pointer to the function to be called.
 
template<typename PointerType, typename = std::enable_if_t< std::is_same<typename std::remove_cv<PointerType>::type, void*>::value>>
void SetPointer (PointerType function)
 
template<typename... RunArgs>
decltype(auto) operator() (RunArgs &&... args) const
 Calls the function without sanitization by cfi-icall.
 
 operator bool () const
 Returns true if not nullptr.
 

Detailed Description

template<typename Functor>
class crashpad::NoCfiIcall< Functor >

Disables cfi-icall for calls made through a function pointer.

Clang provides several Control-Flow-Integrity (CFI) sanitizers, among them, cfi-icall, which attempts to verify that the dynamic type of a function matches the static type of the function pointer used to call it.

https://clang.llvm.org/docs/ControlFlowIntegrity.html#indirect-function-call-checking

However, cfi-icall does not have enough information to check indirect calls to functions in other modules, such as through the pointers returned by dlsym(). In these cases, CFI aborts the program upon executing the indirect call.

This class encapsulates cross-DSO function pointers to disable cfi-icall precisely when calling these pointers.

Constructor & Destructor Documentation

◆ NoCfiIcall() [1/3]

template<typename Functor>
crashpad::NoCfiIcall< Functor >::NoCfiIcall ( Functor function)
inlineexplicit

Constructs this object.

Parameters
functionA pointer to the function to be called.

◆ NoCfiIcall() [2/3]

template<typename Functor>
crashpad::NoCfiIcall< Functor >::NoCfiIcall ( )
inline
See also
NoCfiIcall

◆ NoCfiIcall() [3/3]

template<typename Functor>
template<typename PointerType, typename = std::enable_if_t< std::is_same<typename std::remove_cv<PointerType>::type, void*>::value>>
crashpad::NoCfiIcall< Functor >::NoCfiIcall ( PointerType function)
inlineexplicit
See also
NoCfiIcall

Member Function Documentation

◆ SetPointer() [1/2]

template<typename Functor>
void crashpad::NoCfiIcall< Functor >::SetPointer ( Functor function)
inline

Updates the pointer to the function to be called.

Parameters
functionA pointer to the function to be called.

◆ SetPointer() [2/2]

template<typename Functor>
template<typename PointerType, typename = std::enable_if_t< std::is_same<typename std::remove_cv<PointerType>::type, void*>::value>>
void crashpad::NoCfiIcall< Functor >::SetPointer ( PointerType function)
inline
See also
SetPointer

The documentation for this class was generated from the following file: