Skip to content

Commit 0910bcc

Browse files
committed
Comment: explain the reason to combine auth+sign
1 parent 361469f commit 0910bcc

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
@@ -2993,8 +2993,13 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
29932993
return CallInst::Create(NewFn, CallArgs);
29942994
}
29952995
case Intrinsic::ptrauth_sign: {
2996-
// auth + sign can be replaced with resign, which prevents unsafe
2997-
// spills and reloads of intermediate authenticated value.
2996+
// Replace auth+sign with a single resign intrinsic.
2997+
// When auth and sign operations are performed separately, later compiler
2998+
// passes may spill intermediate result to memory as a raw, unprotected
2999+
// pointer, which makes it possible for an attacker to replace it under
3000+
// PAuth threat model. On the other hand, resign intrinsic is not expanded
3001+
// until AsmPrinter, when it is emitted as a contiguous, non-attackable
3002+
// sequence of instructions.
29983003
Value *Ptr = II->getArgOperand(0);
29993004
Value *SignKey = II->getArgOperand(1);
30003005
Value *SignDisc = II->getArgOperand(2);

0 commit comments

Comments
 (0)