Skip to content

Commit 009d3ba

Browse files
committed
review comments
1 parent a88910d commit 009d3ba

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

llvm/tools/llvm-exegesis/lib/AArch64/Target.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,14 +207,17 @@ class ExegesisAArch64Target : public ExegesisTarget {
207207

208208
if (isPointerAuth(Opcode)) {
209209
#if defined(__aarch64__) && defined(__linux__)
210-
211-
// Fix for some systems where PAC/PAG keys are present but is
212-
// explicitly getting disabled
210+
211+
// For some systems with existing PAC keys set, it is better to
212+
// check the existing state of the key before setting it.
213+
// For systems without PAC, this is a No-op but with PAC, it is
214+
// safer to check the existing key state and then disable/enable them.
215+
// Hence the guard placed for switching.
213216
unsigned long pac_keys = 0;
214217
if (prctl(PR_PAC_GET_ENABLED_KEYS, &pac_keys, 0, 0, 0) < 0) {
215218
return "Failed to get PAC key status";
216219
}
217-
220+
218221
// Disable all PAC keys. Note that while we expect the measurements to
219222
// be the same with PAC keys disabled, they could potentially be lower
220223
// since authentication checks are bypassed.
@@ -226,7 +229,7 @@ class ExegesisAArch64Target : public ExegesisTarget {
226229
0, 0) < 0) {
227230
return "Failed to disable PAC keys";
228231
}
229-
}
232+
}
230233
#else
231234
return "Unsupported opcode: isPointerAuth";
232235
#endif

0 commit comments

Comments
 (0)