[PATCH] D51798: [Dwarf/AArch64] Return address signing B key dwarf support

Luke Cheeseman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 7 08:46:54 PDT 2018


LukeCheeseman created this revision.
LukeCheeseman added reviewers: olista01, kcc, pcc, vlad.tsyrklevich, eugenis.
Herald added subscribers: llvm-commits, JDevlieghere, kristof.beyls, arichardson, aprantl, emaste.
Herald added a reviewer: javed.absar.
Herald added a reviewer: espindola.

- When signing return addresses with -msign-return-address=<scope>{+<key>}, either the A key instructions or the B key instructions can be used. To correctly authenticate the return address, the unwinder/debugger must know which key was used to sign the return address.
- When and exception is thrown or a break point reached, it may be necessary to unwind the stack. To accomplish this, the unwinder/debugger must be able to first authenticate an the return address if it has been signed.
- To enable this, the augmentation string of CIEs has been extended to allow inclusion of a 'B' character. Functions that are signed using the B key variant of the instructions should have and FDE whose associated CIE has a 'B' in the augmentation string.
- One must also be able to preserve these semantics when first stepping from a high level language into assembly and then, as a second step, into an object file. To achieve this, I have introduced a new assembly directive '.append_augmentation "<string>" ', that tells the assembler to append the given string onto the end of the augmentation string of the CIE associated with the current frame. Also, the dwarf frame info struct has been extended to carry around this extra augmentation string, finally being appended onto the augmentation string of the CIE when emitting Dwarf frames into an object file.
- This touches target/vendor independent parts of object file handling. I initially attempted to keep the augmentation string changes localised to the AArch64 backend, however the  Dwarf info is not divided on a per vendor basis and manipulating the augmentation string proved tricky.


Repository:
  rL LLVM

https://reviews.llvm.org/D51798

Files:
  include/llvm/MC/MCDwarf.h
  include/llvm/MC/MCStreamer.h
  lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
  lib/MC/MCAsmStreamer.cpp
  lib/MC/MCDwarf.cpp
  lib/MC/MCParser/AsmParser.cpp
  lib/MC/MCStreamer.cpp
  lib/Target/AArch64/AArch64AsmPrinter.cpp
  lib/Target/AArch64/AArch64FrameLowering.cpp
  lib/Target/AArch64/AArch64InstrInfo.td
  test/CodeGen/MIR/AArch64/return-address-signing.mir
  test/DebugInfo/AArch64/return-address-signing.ll
  test/MC/ELF/appendaugmentation.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51798.164428.patch
Type: text/x-patch
Size: 14257 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180907/41355638/attachment.bin>


More information about the llvm-commits mailing list