[all-commits] [llvm/llvm-project] e6d0b8: [ARM][libunwind] add PACBTI-M support for libunwind

Ties Stuij via All-commits all-commits at lists.llvm.org
Wed Dec 8 02:05:14 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e6d0b851f854849240bc1f02901b0dbb3be84388
      https://github.com/llvm/llvm-project/commit/e6d0b851f854849240bc1f02901b0dbb3be84388
  Author: Ties Stuij <ties.stuij at arm.com>
  Date:   2021-12-08 (Wed, 08 Dec 2021)

  Changed paths:
    M clang/lib/Headers/unwind.h
    M libunwind/include/libunwind.h
    M libunwind/include/unwind_arm_ehabi.h
    M libunwind/src/DwarfInstructions.hpp
    M libunwind/src/Registers.hpp
    M libunwind/src/Unwind-EHABI.cpp
    M libunwind/src/UnwindCursor.hpp
    M libunwind/src/UnwindRegistersRestore.S
    M libunwind/src/assembly.h

  Log Message:
  -----------
  [ARM][libunwind] add PACBTI-M support for libunwind

This patch implements the following:

- Emit PACBTI-M build attributes in libunwind asm files

- Authenticate LR in DWARF32 using PACBTI

Use Armv8.1-M.Main PACBTI extension to authenticate the return address
(stored in the LR register) before moving it to the PC (IP) register.

The AUTG instruction is used with the candidate return address, the CFA,
and the authentication code that is retrieved from the saved
pseudo-register RA_AUTH_CODE.

- Authenticate LR in EHABI using PACBTI

Authenticate the contents of the LR register using Armv8.1-M.Main PACBTI
extension.

A new frame unwinding instruction is introduced (0xb4). This
instruction pops out of the stack the return address authentication
code, which is then used in conjunction with the SP and the next-to-be
instruction pointer to perform authentication.

This authentication code is popped into a new register,
UNW_ARM_PSEUDO_PAC, which is a pseudo-register.

This patch is part of a series that adds support for the PACBTI-M extension of
the Armv8.1-M architecture, as detailed here:

https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/armv8-1-m-pointer-authentication-and-branch-target-identification-extension

The PACBTI-M specification can be found in the Armv8-M Architecture Reference
Manual:

https://developer.arm.com/documentation/ddi0553/latest

The following people contributed to this patch:

- Momchil Velikov
- Victor Campos
- Ties Stuij

Reviewed By: #libunwind, danielkiss, mstorsjo

Differential Revision: https://reviews.llvm.org/D112430




More information about the All-commits mailing list