llvm-project/compiler-rt/lib
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
..
BlocksRuntime Move tests for BlocksRuntime and builtins to corresponding directories under test/ 2014-02-14 09:47:31 +00:00
asan [tests] Portability fixup for r261713. 2016-02-24 01:28:51 +00:00
builtins builtins: adjust the clobbers list for android __clear_cache 2016-02-25 04:04:37 +00:00
cfi [CMake] Assign components and dependencies during add_compiler_rt_resource_file 2016-02-23 21:50:39 +00:00
dfsan [compiler-rt] [dfsan] Unify aarch64 mapping 2015-11-27 12:43:33 +00:00
interception Remove autoconf support for building runtime libraries. 2016-01-26 21:31:12 +00:00
lsan [Sanitizer] Introduce ListOfModules object and use it to replace GetListOfModules(). 2016-02-22 18:52:51 +00:00
msan [MSan] Endianness should not matter while printing a byte 2016-02-26 06:44:10 +00:00
profile [profile] Compute number of data entries correctly 2016-02-26 02:49:41 +00:00
safestack [compiler-rt] [safestack] Enable for aarch64 2015-12-11 17:38:38 +00:00
sanitizer_common [UBSan] Fix isDerivedFromAtOffset on iOS ARM64 2016-02-27 19:57:44 +00:00
stats [Sanitizer] Introduce ListOfModules object and use it to replace GetListOfModules(). 2016-02-22 18:52:51 +00:00
tsan tsan: revert r262037 2016-02-26 18:26:48 +00:00
ubsan [UBSan] Fix isDerivedFromAtOffset on iOS ARM64 2016-02-27 19:57:44 +00:00
CMakeLists.txt Introduce stats and stats_client libraries. 2016-01-16 00:31:29 +00:00
Makefile.mk Remove autoconf support for building runtime libraries. 2016-01-26 21:31:12 +00:00