llvm-project/compiler-rt/lib
Peter Collingbourne e44acadf6a Implement CFI for indirect calls via a member function pointer.
Similarly to CFI on virtual and indirect calls, this implementation
tries to use program type information to make the checks as precise
as possible.  The basic way that it works is as follows, where `C`
is the name of the class being defined or the target of a call and
the function type is assumed to be `void()`.

For virtual calls:
- Attach type metadata to the addresses of function pointers in vtables
  (not the functions themselves) of type `void (B::*)()` for each `B`
  that is a recursive dynamic base class of `C`, including `C` itself.
  This type metadata has an annotation that the type is for virtual
  calls (to distinguish it from the non-virtual case).
- At the call site, check that the computed address of the function
  pointer in the vtable has type `void (C::*)()`.

For non-virtual calls:
- Attach type metadata to each non-virtual member function whose address
  can be taken with a member function pointer. The type of a function
  in class `C` of type `void()` is each of the types `void (B::*)()`
  where `B` is a most-base class of `C`. A most-base class of `C`
  is defined as a recursive base class of `C`, including `C` itself,
  that does not have any bases.
- At the call site, check that the function pointer has one of the types
  `void (B::*)()` where `B` is a most-base class of `C`.

Differential Revision: https://reviews.llvm.org/D47567

llvm-svn: 335569
2018-06-26 02:15:47 +00:00
..
BlocksRuntime [compiler-rt] Test commit: remove some trailing white spaces. 2017-08-25 19:36:30 +00:00
asan [Sanitizers] Remove OOM/BadRequest allocator error handling policies. 2018-06-20 17:10:33 +00:00
builtins Fix bots after r334981 2018-06-19 02:56:24 +00:00
cfi [sanitizer] Build failures fixes post D45457 2018-04-16 16:58:34 +00:00
dfsan Add weak definitions of trace-cmp hooks to dfsan 2018-06-01 21:59:25 +00:00
esan [sanitizer] Add fgets, fputs and puts into sanitizer_common 2018-06-11 22:58:04 +00:00
fuzzer [libFuzzer] Use Vector rather than std::vector. 2018-06-25 15:59:24 +00:00
hwasan [HWASan] Initalize shadow earler. 2018-06-25 17:27:13 +00:00
interception [sanitizer] Trivial portion of the port to Myriad RTEMS 2018-05-18 00:43:54 +00:00
lsan [Lsan] intercept thr_exit on FreeBSD 2018-06-20 20:13:25 +00:00
msan [sanitizer] Use confstr to check libc version in InitTlsSize 2018-06-17 17:31:22 +00:00
profile [CMake] Build shared version of runtimes for Fuchsia 2018-05-09 21:24:06 +00:00
safestack [safestack] Lazy initialization of interceptors 2018-05-26 01:18:32 +00:00
sanitizer_common [Lsan] intercept thr_exit on FreeBSD 2018-06-20 20:13:25 +00:00
scudo [scudo] Add a minimal runtime for -fsanitize-minimal-runtime compatibility 2018-06-21 21:48:04 +00:00
stats [sanitizer] Replace InternalScopedBuffer with InternalMmapVector 2018-05-07 05:56:36 +00:00
tsan tsan: fix deficiency in MutexReadOrWriteUnlock 2018-06-22 08:27:52 +00:00
ubsan Implement CFI for indirect calls via a member function pointer. 2018-06-26 02:15:47 +00:00
ubsan_minimal [CMake] Build shared version of runtimes for Fuchsia 2018-05-09 21:24:06 +00:00
xray [XRay] Fix error message. NFC 2018-06-19 15:39:19 +00:00
CMakeLists.txt [cmake] Add a separate CMake var to control profile runtime 2017-10-02 05:03:55 +00:00