[compiler-rt] [PAC][compiler-rt][UBSan] Strip signed vptr instead of authenticating it (PR #100153)
Akira Hatanaka via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 23 09:34:06 PDT 2024
https://github.com/ahatanak created https://github.com/llvm/llvm-project/pull/100153
vtpr cannot be authenticated without knowing the class type if it was signed with type discrimination.
Co-authored-by: Oliver Hunt <oliver at apple.com>
>From 9be00efb6bc96d332092946441a0b824f961a1b5 Mon Sep 17 00:00:00 2001
From: Akira Hatanaka <ahatanak at gmail.com>
Date: Mon, 22 Jul 2024 20:42:26 -0700
Subject: [PATCH] [PAC][compiler-rt][UBSan] Strip signed vptr instead of
authenticating it
vtpr cannot be authenticated without knowing the class type if it was
signed with type discrimination.
Co-authored-by: Oliver Hunt <oliver at apple.com>
---
compiler-rt/lib/ubsan/ubsan_type_hash_itanium.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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-commits
mailing list