[llvm-branch-commits] [clang] [clang] Implement pointer authentication for C++ virtual functions, v-tables, and VTTs (PR #94056)
Anton Korobeynikov via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sat Jun 8 00:13:26 PDT 2024
================
@@ -2456,10 +2456,20 @@ class CodeGenFunction : public CodeGenTypeCache {
void InitializeVTablePointers(const CXXRecordDecl *ClassDecl);
+ // VTableTrapMode - whether we guarantee that loading the
+ // vtable is guaranteed to trap on authentication failure,
+ // even if the resulting vtable pointer is unused.
+ enum class VTableAuthMode {
+ Authenticate,
+ MustTrap,
+ UnsafeUbsanStrip // Should only be used for Vptr UBSan check
+ };
/// GetVTablePtr - Return the Value of the vtable pointer member pointed
/// to by This.
- llvm::Value *GetVTablePtr(Address This, llvm::Type *VTableTy,
- const CXXRecordDecl *VTableClass);
+ llvm::Value *
+ GetVTablePtr(Address This, llvm::Type *VTableTy,
+ const CXXRecordDecl *VTableClass,
+ VTableAuthMode authMode = VTableAuthMode::Authenticate);
----------------
asl wrote:
```suggestion
VTableAuthMode AuthMode = VTableAuthMode::Authenticate);
```
https://github.com/llvm/llvm-project/pull/94056
More information about the llvm-branch-commits
mailing list