[PAC][compiler-rt][UBSan] Strip signed vptr instead of authenticating it (#100153)

vptr cannot be authenticated without knowing the class type if it was
signed with type discrimination.

Co-authored-by: Oliver Hunt <oliver@apple.com>
This commit is contained in:
Akira Hatanaka 2024-07-23 14:39:58 -07:00 committed by GitHub
parent 5e97bfb098
commit 0a6a3c152f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -207,7 +207,7 @@ struct VtablePrefix {
std::type_info *TypeInfo;
};
VtablePrefix *getVtablePrefix(void *Vtable) {
Vtable = ptrauth_auth_data(Vtable, ptrauth_key_cxx_vtable_pointer, 0);
Vtable = ptrauth_strip(Vtable, ptrauth_key_cxx_vtable_pointer);
VtablePrefix *Vptr = reinterpret_cast<VtablePrefix*>(Vtable);
VtablePrefix *Prefix = Vptr - 1;
if (!IsAccessibleMemoryRange((uptr)Prefix, sizeof(VtablePrefix)))