Skip to content

Commit

Permalink
[PAC][compiler-rt][UBSan] Strip signed vptr instead of authenticating…
Browse files Browse the repository at this point in the history
… it (llvm#100153)

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

Co-authored-by: Oliver Hunt <[email protected]>
(cherry picked from commit 0a6a3c1)
  • Loading branch information
ahatanak authored and tru committed Jul 24, 2024
1 parent 843276a commit 95ed2d0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compiler-rt/lib/ubsan/ubsan_type_hash_itanium.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down

0 comments on commit 95ed2d0

Please sign in to comment.