[llvm] [BOLT][binary-analysis] Add initial pac-ret gadget scanner (PR #122304)

Jacob Bramley via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 10 13:36:22 PST 2025


================
@@ -148,6 +149,68 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
     return false;
   }
 
+  MCPhysReg getAuthenticatedReg(const MCInst &Inst) const override {
+    switch (Inst.getOpcode()) {
+    case AArch64::AUTIAZ:
+    case AArch64::AUTIBZ:
+    case AArch64::AUTIASP:
+    case AArch64::AUTIBSP:
+    case AArch64::RETAA:
+    case AArch64::RETAB:
+      return AArch64::LR;
+    case AArch64::AUTIA1716:
+    case AArch64::AUTIB1716:
+      return AArch64::X17;
+    case AArch64::ERETAA:
+    case AArch64::ERETAB:
+      return AArch64::LR;
----------------
jacobbramley wrote:

I'm not very aware of all the details, but don't `ERET` instructions return to `ELR`? Tracking writes to that might actually be simpler — presumably an `MSR` — but would need a different mechanism.

https://github.com/llvm/llvm-project/pull/122304


More information about the llvm-commits mailing list