Skip to content

Commit 57ca35a

Browse files
committed
Partially address the review comments
1 parent 2f656d7 commit 57ca35a

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

bolt/lib/Passes/PAuthGadgetScanner.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,10 +340,9 @@ class SrcSafetyAnalysis {
340340

341341
SrcState createEntryState() {
342342
SrcState S(NumRegs, RegsToTrackInstsFor.getNumTrackedRegisters());
343-
for (MCPhysReg Reg : BC.MIB->getTrustedLiveInRegs()) {
343+
for (MCPhysReg Reg : BC.MIB->getTrustedLiveInRegs())
344344
S.TrustedRegs |= BC.MIB->getAliases(Reg, /*OnlySmaller=*/true);
345-
S.SafeToDerefRegs = S.TrustedRegs;
346-
}
345+
S.SafeToDerefRegs = S.TrustedRegs;
347346
return S;
348347
}
349348

bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,22 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
491491

492492
// If signing oracles are considered, the particular value left in the base
493493
// register after this instruction is important. This function checks that
494-
// if the base register was overwritten, it is due to address write-back.
494+
// if the base register was overwritten, it is due to address write-back:
495+
//
496+
// ; good:
497+
// autdza x1 ; x1 is authenticated (may fail)
498+
// ldr x0, [x1, #8] ; x1 is checked and not changed
499+
// pacdzb x1
500+
//
501+
// ; also good:
502+
// autdza x1
503+
// ldr x0, [x1, #8]! ; x1 is checked and incremented by 8
504+
// pacdzb x1
505+
//
506+
// ; bad (the value being signed is not the authenticated one):
507+
// autdza x1
508+
// ldr x1, [x1, #8] ; x1 is overwritten with an unrelated value
509+
// pacdzb x1
495510
//
496511
// Note that this function is not needed for authentication oracles, as the
497512
// particular value left in the register after a successful memory access

0 commit comments

Comments
 (0)