[llvm-branch-commits] [compiler-rt] 95ed2d0 - [PAC][compiler-rt][UBSan] Strip signed vptr instead of authenticating it (#100153)

Tobias Hieta via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jul 24 00:05:53 PDT 2024


Author: Akira Hatanaka
Date: 2024-07-24T09:05:40+02:00
New Revision: 95ed2d007951374c8ae905b2cce4be262865e442

URL: https://github.com/llvm/llvm-project/commit/95ed2d007951374c8ae905b2cce4be262865e442
DIFF: https://github.com/llvm/llvm-project/commit/95ed2d007951374c8ae905b2cce4be262865e442.diff

LOG: [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 at apple.com>
(cherry picked from commit 0a6a3c152faf56e07dd4f9e89e534d2b97eeab56)

Added: 
    

Modified: 
    compiler-rt/lib/ubsan/ubsan_type_hash_itanium.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/ubsan/ubsan_type_hash_itanium.cpp b/compiler-rt/lib/ubsan/ubsan_type_hash_itanium.cpp
index 468a8fcd603f0..15788574dd995 100644
--- a/compiler-rt/lib/ubsan/ubsan_type_hash_itanium.cpp
+++ b/compiler-rt/lib/ubsan/ubsan_type_hash_itanium.cpp
@@ -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)))


        


More information about the llvm-branch-commits mailing list