Skip to content

Commit 42b372c

Browse files
committed
Comment: explain the reason to combine auth+sign
1 parent 52f3913 commit 42b372c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3049,8 +3049,13 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
30493049
return CallInst::Create(NewFn, CallArgs);
30503050
}
30513051
case Intrinsic::ptrauth_sign: {
3052-
// auth + sign can be replaced with resign, which prevents unsafe
3053-
// spills and reloads of intermediate authenticated value.
3052+
// Replace auth+sign with a single resign intrinsic.
3053+
// When auth and sign operations are performed separately, later compiler
3054+
// passes may spill intermediate result to memory as a raw, unprotected
3055+
// pointer, which makes it possible for an attacker to replace it under
3056+
// PAuth threat model. On the other hand, resign intrinsic is not expanded
3057+
// until AsmPrinter, when it is emitted as a contiguous, non-attackable
3058+
// sequence of instructions.
30543059
Value *Ptr = II->getArgOperand(0);
30553060
Value *SignKey = II->getArgOperand(1);
30563061
Value *SignDisc = II->getArgOperand(2);

0 commit comments

Comments
 (0)