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 . | |
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.
|
inlineexplicit |
Constructs this object.
function | A pointer to the function to be called. |
|
inline |
|
inlineexplicit |
|
inline |
Updates the pointer to the function to be called.
function | A pointer to the function to be called. |
|
inline |