[PATCH] D55704: [AArch64][libunwind] Unwinding support for return address signing with B Key

Luke Cheeseman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 17 03:46:42 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL349339: [AArch64][libunwind] Unwinding support for return address signing with B Key (authored by LukeCheeseman, committed by ).
Herald added a subscriber: christof.

Changed prior to commit:
  https://reviews.llvm.org/D55704?vs=178226&id=178438#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55704/new/

https://reviews.llvm.org/D55704

Files:
  libunwind/trunk/src/DwarfInstructions.hpp
  libunwind/trunk/src/DwarfParser.hpp


Index: libunwind/trunk/src/DwarfInstructions.hpp
===================================================================
--- libunwind/trunk/src/DwarfInstructions.hpp
+++ libunwind/trunk/src/DwarfInstructions.hpp
@@ -211,9 +211,13 @@
         register unsigned long long x17 __asm("x17") = returnAddress;
         register unsigned long long x16 __asm("x16") = cfa;
 
-        // This is the autia1716 instruction. The hint instruction is used here
-        // as gcc does not assemble autia1716 for pre armv8.3a targets.
-        asm("hint 0xc": "+r"(x17): "r"(x16));
+        // These are the autia1716/autib1716 instructions. The hint instructions
+        // are used here as gcc does not assemble autia1716/autib1716 for pre
+        // armv8.3a targets.
+        if (cieInfo.addressesSignedWithBKey)
+          asm("hint 0xe" : "+r"(x17) : "r"(x16)); // autib1716
+        else
+          asm("hint 0xc" : "+r"(x17) : "r"(x16)); // autia1716
         returnAddress = x17;
 #endif
       }
Index: libunwind/trunk/src/DwarfParser.hpp
===================================================================
--- libunwind/trunk/src/DwarfParser.hpp
+++ libunwind/trunk/src/DwarfParser.hpp
@@ -49,6 +49,9 @@
     bool      isSignalFrame;
     bool      fdesHaveAugmentationData;
     uint8_t   returnAddressRegister;
+#if defined(_LIBUNWIND_TARGET_AARCH64)
+    bool      addressesSignedWithBKey;
+#endif
   };
 
   /// Information about an FDE (Frame Description Entry)
@@ -263,6 +266,9 @@
   cieInfo->dataAlignFactor = 0;
   cieInfo->isSignalFrame = false;
   cieInfo->fdesHaveAugmentationData = false;
+#if defined(_LIBUNWIND_TARGET_AARCH64)
+  cieInfo->addressesSignedWithBKey = false;
+#endif
   cieInfo->cieStart = cie;
   pint_t p = cie;
   pint_t cieLength = (pint_t)addressSpace.get32(p);
@@ -326,6 +332,11 @@
       case 'S':
         cieInfo->isSignalFrame = true;
         break;
+#if defined(_LIBUNWIND_TARGET_AARCH64)
+      case 'B':
+        cieInfo->addressesSignedWithBKey = true;
+        break;
+#endif
       default:
         // ignore unknown letters
         break;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55704.178438.patch
Type: text/x-patch
Size: 2082 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181217/37f58024/attachment.bin>


More information about the llvm-commits mailing list