llvm-project/compiler-rt/lib/ubsan
Filipe Cabecinhas b7692bc3e9 [UBSan] Fix isDerivedFromAtOffset on iOS ARM64
Summary:
iOS on ARM64 doesn't unique RTTI.
Ref: clang's iOS64CXXABI::shouldRTTIBeUnique()

Due to this, pointer-equality will not necessarily work in this
architecture, across dylib boundaries.

dynamic_cast<>() will (as expected) still work, since Apple ships with
one prepared for this, but we can't rely on the type names being
pointer-equal.

I've limited the expensive strcmp check to the specific architecture
which needs it.

Example which triggers this bug:

lib.h:
  struct X {
    virtual ~X() {}
  };
  X *libCall();

lib.mm:
  X *libCall() {
    return new X;
  }

prog.mm:
  int main() {
    X *px = libCall();
    delete px;
  }

Expected output: Nothing
Actual output:
<unknown>: runtime error: member call on address 0x00017001ef50 which does not point to an object of type 'X'
0x00017001ef50: note: object is of type 'X'
 00 00 00 00  60 00 0f 00 01 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00
              ^~~~~~~~~~~~~~~~~~~~~~~
              vptr for ‘X’

Reviewers: kubabrecka, samsonov, eugenis, rsmith

Subscribers: aemerson, llvm-commits, rengolin

Differential Revision: http://reviews.llvm.org/D11502

llvm-svn: 262147
2016-02-27 19:57:44 +00:00
..
CMakeLists.txt [cfi] Disable vtable diagnostics when no cxxabi. 2016-01-27 21:15:10 +00:00
ubsan.syms.extra Properly generate lists of exported symbols for sanitizer runtimes 2013-08-27 15:08:02 +00:00
ubsan_checks.inc [UBSan] Remove "-fsanitize=" prefix from ubsan_checks.inc. NFC. 2015-12-08 23:29:36 +00:00
ubsan_diag.cc [UBSan] Implement runtime suppressions (PR25066). 2015-12-18 19:56:42 +00:00
ubsan_diag.h [UBSan] Implement runtime suppressions (PR25066). 2015-12-18 19:56:42 +00:00
ubsan_flags.cc [UBSan] Enable 'help' option output, report unrecognized flags 2015-08-13 20:34:00 +00:00
ubsan_flags.h [UBSan] Embed UBSan into ASan runtime (compiler-rt part). 2015-04-01 22:42:36 +00:00
ubsan_flags.inc [UBSan] Add the ability to print more precise error kind in summary line. 2015-08-24 23:18:49 +00:00
ubsan_handlers.cc [cfi] Safe handling of unaddressable vtable pointers (compiler-rt). 2016-02-03 22:19:04 +00:00
ubsan_handlers.h [cfi] Safe handling of unaddressable vtable pointers (compiler-rt). 2016-02-03 22:19:04 +00:00
ubsan_handlers_cxx.cc [cfi] Safe handling of unaddressable vtable pointers (compiler-rt). 2016-02-03 22:19:04 +00:00
ubsan_handlers_cxx.h [cfi] Cross-DSO CFI diagnostic mode (compiler-rt part) 2016-01-25 23:34:38 +00:00
ubsan_init.cc [ASan] Make binary name reader cross-platform. 2015-06-04 07:29:43 +00:00
ubsan_init.h [UBSan] Embed UBSan into ASan runtime (compiler-rt part). 2015-04-01 22:42:36 +00:00
ubsan_init_standalone.cc [UBSan] Add missing header that defines SANITIZER_CAN_USE_PREINIT_ARRAY 2015-05-11 21:06:49 +00:00
ubsan_platform.h Re-apply r241217 with build fixes: 2015-07-02 01:44:34 +00:00
ubsan_type_hash.cc CFI: Get check-cfi passing on Windows. 2015-07-08 22:10:34 +00:00
ubsan_type_hash.h Add control flow integrity diagnosis function to UBSan runtime library. 2015-06-19 01:52:55 +00:00
ubsan_type_hash_itanium.cc [UBSan] Fix isDerivedFromAtOffset on iOS ARM64 2016-02-27 19:57:44 +00:00
ubsan_type_hash_win.cc UBSan: Simplify logic for locating the RTTI object. 2015-07-08 23:22:39 +00:00
ubsan_value.cc [ubsan][mips] Revise r243384 to avoid special casing big-endian mips. 2015-08-11 18:40:02 +00:00
ubsan_value.h [UBSan] Explicitly list all supported OS/arch pairs supported by UBSan. 2015-03-26 17:26:04 +00:00