This problem arises because ubsan can not currently import c++ headers, and the type_info definition goes out of sync.
On arm64 Apple, we have the NonUniqueARMRTTIBit implementation of typeinfo. Copying from typeinfo header:
// When constructing the type_info, // the compiler packs the pointer to the type name into a uintptr_t and reserves // the high bit of that pointer, which is assumed to be free for use under that // ABI. If that high bit is set, that specific copy of the RTTI can't be assumed // to be unique within the program. If the high bit is unset, then the RTTI can // be assumed to be unique within the program.
The corresponding implementation __non_unique_arm_rtti_bit_impl masks out these bits when returning the pointer to the type name in __type_name_to_string function. This patch just syncs the type_info definition in ubsan with this masking.
The fix is needed because some ubsan tests (vptr*) crash while trying to symbolicate the type name during diagnositcs.