[clang] [llvm] [AArch64][PAC] Sign block addresses used in indirectbr. (PR #97647)
Eli Friedman via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 22 16:57:47 PDT 2024
================
@@ -10909,6 +10909,14 @@ QualType Sema::CheckAdditionOperands(ExprResult &LHS, ExprResult &RHS,
if (isObjCPointer && checkArithmeticOnObjCPointer(*this, Loc, PExp))
return QualType();
+ // Arithmetic on label addresses is normally allowed, except when we add
+ // a ptrauth signature to the addresses.
+ if (isa<AddrLabelExpr>(PExp) && getLangOpts().PointerAuthIndirectGotos) {
----------------
efriedma-quic wrote:
I don't think this catches all the relevant cases: there are various ways you could "hide" an address-of-label from this check. Parentheses, a conditional operator, a constexpr variable, etc.
Maybe the check should be in IntExprEvaluator::VisitBinaryOperator.
https://github.com/llvm/llvm-project/pull/97647
More information about the cfe-commits
mailing list