================
@@ -7538,6 +7538,14 @@ static bool IsEligibleForTrivialRelocation(Sema &SemaRef,
     if (!SemaRef.IsCXXTriviallyRelocatableType(Field->getType()))
       return false;
   }
+
+  // FIXME: PFP should not affect trivial relocatability, instead it should
+  // affect the implementation of std::trivially_relocate. See:
+  // 
https://discourse.llvm.org/t/rfc-structure-protection-a-family-of-uaf-mitigation-techniques/85555/16?u=pcc
+  if (!SemaRef.Context.arePFPFieldsTriviallyRelocatable(D) &&
----------------
pcc wrote:

Looking at the code again: `IsCXXTriviallyRelocatableType(QualType Type)` is 
already returning false as a result of this change because it calls 
`IsCXXTriviallyRelocatableType(Sema &S, const CXXRecordDecl *RD)` if the base 
type is determined to be a record type. That function will call 
`CheckCXX2CRelocatableAndReplaceable` if the result is not cached. 
`CheckCXX2CRelocatableAndReplaceable` will use the code that I am modifying to 
set `CXXRecordDeclRelocationInfo::IsRelocatable` which will become the return 
value of  `IsCXXTriviallyRelocatableType(Sema &S, const CXXRecordDecl *RD)`. So 
I think this is the right place to make the change and PAuth ABI should likely 
move to the same place if it wants to cache the result.

https://github.com/llvm/llvm-project/pull/133538
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to