Skip to content

[llvm-exegesis][AArch64] Disable pauth and ldgm as unsupported instructions fixed #136868

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Apr 28, 2025
Merged
Changes from 14 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
f1e1d7a
[llvm-exegesis] [AArch64] Resolving Illegal Instruction Error
lakshayk-nv Mar 21, 2025
5039c2b
[llvm-exegesis] [AArch64] Use enum values for opcode validation
lakshayk-nv Mar 24, 2025
6b81e65
[llvm-exegesis][AArch64] Disable pauth and ldgm as unsupported instru…
lakshayk-nv Mar 26, 2025
bef8e21
Merge branch 'main' of https://github.com/llvm/llvm-project into llvm…
lakshayk-nv Apr 1, 2025
dade502
[llvm-exegesis][AArch64] Formatting changes
lakshayk-nv Apr 1, 2025
b6ce448
[llvm-exegesis] Add Linux PR_PAC_* constants and update opcode handling
lakshayk-nv Apr 1, 2025
783f86d
[llvm-exegesis][AArch64] Updated the testcase for AUT instruction class.
lakshayk-nv Apr 1, 2025
70eb3bf
[llvm-exegesis][AArch64] Refactor opcode handling for pointer authent…
lakshayk-nv Apr 3, 2025
a1fedb4
[llvm-exegesis][AArch64] Enhance pointer authentication handling for …
lakshayk-nv Apr 3, 2025
06fbe30
Revert "[llvm-exegesis][AArch64] Formatting changes"
lakshayk-nv Apr 4, 2025
3af87a0
[llvm-exegesis][AArch64] Revert back unnecessary unfolded error and f…
lakshayk-nv Apr 7, 2025
15331c6
Merge branch 'main' of github.com:llvm/llvm-project into llvm-exegesi…
lakshayk-nv Apr 9, 2025
8f348bd
[llvm-exegesis][AArch64] Update PAC key handling for Linux
lakshayk-nv Apr 23, 2025
a692e8a
Merge branch 'main' into llvm-exegesis-illegal-instr
lakshayk-nv Apr 23, 2025
6fec9de
Merge branch 'main' into llvm-exegesis-illegal-instr
lakshayk-nv Apr 23, 2025
7f57ac8
[llvm-exegesis] [AArch64] Testcase file and pauth, LDGM opocde checke…
lakshayk-nv Apr 24, 2025
e5c624f
[llvm-exegesis] [AArch64] Add PR_PAC_GET_ENABLED_KEYS explicit defina…
lakshayk-nv Apr 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions llvm/tools/llvm-exegesis/lib/AArch64/Target.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@
#include "AArch64.h"
#include "AArch64RegisterInfo.h"

#if defined(__aarch64__) && defined(__linux__)
#include <linux/prctl.h> // For PR_PAC_* constants
#include <sys/prctl.h>
#ifndef PR_PAC_SET_ENABLED_KEYS
#define PR_PAC_SET_ENABLED_KEYS 60
#endif
#endif

#define GET_AVAILABLE_OPCODE_CHECKER
#include "AArch64GenInstrInfo.inc"

Expand Down Expand Up @@ -134,6 +142,35 @@ class ExegesisAArch64Target : public ExegesisTarget {
// Function return is a pseudo-instruction that needs to be expanded
PM.add(createAArch64ExpandPseudoPass());
}

const char *getIgnoredOpcodeReasonOrNull(const LLVMState &State,
unsigned Opcode) const override {
if (const char *Reason =
ExegesisTarget::getIgnoredOpcodeReasonOrNull(State, Opcode))
return Reason;

if (isPointerAuth(Opcode)) {
#if defined(__aarch64__) && defined(__linux__)
// Disable all PAC keys. Note that while we expect the measurements to
// be the same with PAC keys disabled, they could potentially be lower
// since authentication checks are bypassed.
if (prctl(PR_PAC_SET_ENABLED_KEYS,
PR_PAC_APIAKEY | PR_PAC_APIBKEY | PR_PAC_APDAKEY |
PR_PAC_APDBKEY, // all keys
0, // disable all
0, 0) < 0) {
return "Failed to disable PAC keys";
}
#else
return "Unsupported opcode: isPointerAuth";
#endif
}

if (isLoadTagMultiple(Opcode))
return "Unsupported opcode: load tag multiple";

return nullptr;
}
};

} // namespace
Expand Down
Loading