Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jiong Wang <jiong.wang@foss.arm.com>
To: gcc-patches <gcc-patches@gcc.gnu.org>,
	gdb-patches@sourceware.org, Binutils <binutils@sourceware.org>
Cc: "Richard Earnshaw (lists)" <Richard.Earnshaw@arm.com>
Subject: [1/9][RFC][DWARF] Reserve three DW_OP numbers in vendor extension space
Date: Fri, 11 Nov 2016 18:22:00 -0000	[thread overview]
Message-ID: <72418e98-a400-c503-e8ce-c3fbe1ecc4a7@foss.arm.com> (raw)
In-Reply-To: <c9da17a6-c3de-4466-c023-4e4ddbe38efb@foss.arm.com>

[-- Attachment #1: Type: text/plain, Size: 3591 bytes --]

This patch introduces three AARCH64 private DWARF operations in vendor extension
space.

DW_OP_AARCH64_pauth 0xea
===
   Takes one unsigned LEB 128 Pointer Authentication Description. Bits [3:0] of
   the description contain the Authentication Action Code. All unused bits are
   initialized to 0. The operation then proceeds according to the value of the
   action code as described in the Action Code Table.

DW_OP_AARCH64_paciasp 0xeb
===
   Authenticates the contents in X30/LR register as per A key for instruction
   pointer using current CFA as salt. The result is pushed onto the stack.

DW_OP_AARCH64_paciasp_deref 0xec
===
   Takes one signed LEB128 offset and retrieves 8-byte contents from the address
   calculated by CFA plus this offset, the contents then authenticated as per A
   key for instruction pointer using current CFA as salt. The result is pushed
   onto the stack.

Action Code Table
==================================
Action Code      |     Note
----------------------------------
0                |  Pops a single 8-byte operand from the stack representing a
                  |  signed instruction pointer, "drops" the authentication
                  |  signature and pushes the value  onto stack.
----------------------------------
1                |  Pops a single 8-byte operand from the stack representing a
                  |  signed data pointer, "drops" the authentication signature
                  |  and pushes the value on to stack.
----------------------------------
2                |  Bits [7:4] of the Pointer Authentication Description contain
                  |  an Authentication Key Index. The operation then pops the top
                  |  two stack entries. The first is an 8-byte value to be
                  |  authenticated. The second is an 8-byte salt. The first value
                  |  is then authenticated as per the Authentication Key Index
                  |  using the salt. The result is pushed onto stack.

Authentication Key Index
=================================
0                |  A key for instruction pointer.
---------------------------------
1                |  B key for instruction pointer.
---------------------------------
2                |  A key for data pointer.
---------------------------------
3                |  B key for data pointer.
---------------------------------
4                |  A key for general pointer.

DW_OP_AARCH64_pauth is designed to offer general description for all scenarios.

DW_OP_AARCH64_paciasp and DW_OP_AARCH64_paciasp_deref are two shortcut
operations for return address signing.  They offer more compact debug frame
encoding.

For DWARF operation vendor extension space between DW_OP_lo_user and
DW_OP_hi_user, I think vendor is free to reserve any number and numbers for one
vender can overlap with the other, as operations for different vendors are
not supposed to co-exist.

One exception is that GNU toolchain have reserved some numbers inside this space
(DW_OP_GNU*), so vendor's numbers need to avoid overlapping with them.

For these three numbers,  they are not used in LLVM's implementation.

NOTE: the assigned values are provisional, we may need to change them if they are
found to be in conflict with on other toolchains.

Please review, Thanks.


include/
2016-11-09  Richard Earnshaw<richard.earnshaw@arm.com>
             Jiong Wang<jiong.wang@arm.com>

         * dwarf2.def (DW_OP_AARCH64_pauth): Reserve the number 0xea.
         (DW_OP_AARCH64_paciasp): Reserve the number 0xeb.
         (Dw_OP_AARCH64_paciasp_deref): Reserve the number 0xec.


[-- Attachment #2: 1.patch --]
[-- Type: text/x-patch, Size: 958 bytes --]

diff --git a/include/dwarf2.def b/include/dwarf2.def
index 5241fe8615e0e3b288fee80c08a67723686ef411..8eaa90c3b4748ecfc025a6c2dd6afcd5fd80be28 100644
--- a/include/dwarf2.def
+++ b/include/dwarf2.def
@@ -631,6 +631,16 @@ DW_OP (DW_OP_HP_unmod_range, 0xe5)
 DW_OP (DW_OP_HP_tls, 0xe6)
 /* PGI (STMicroelectronics) extensions.  */
 DW_OP (DW_OP_PGI_omp_thread_num, 0xf8)
+/* ARM extension for pointer authentication
+   DW_OP_AARCH64_pauth: takes one uleb128 operand which is authentication
+   descriptor.  Perform actions indicated by the descriptor.
+   DW_OP_AARCH64_paciasp: no operand.  Authenticate value in X30/LR using A key
+   and CFA as salt.
+   DW_OP_AARCH64_paciasp_deref: takes one sleb128 operand as offset.
+   Authenticate value in [CFA + offset] using A key and salt is CFA.  */
+DW_OP (DW_OP_AARCH64_pauth, 0xea)
+DW_OP (DW_OP_AARCH64_paciasp, 0xeb)
+DW_OP (DW_OP_AARCH64_paciasp_deref, 0xec)
 DW_END_OP
 
 DW_FIRST_ATE (DW_ATE_void, 0x0)


       reply	other threads:[~2016-11-11 18:22 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <c9da17a6-c3de-4466-c023-4e4ddbe38efb@foss.arm.com>
2016-11-11 18:22 ` Jiong Wang [this message]
2016-11-11 19:39   ` Jakub Jelinek
2016-11-15 16:00     ` Jiong Wang
2016-11-15 16:18       ` Jakub Jelinek
2016-11-15 16:48         ` Jiong Wang
2016-11-15 19:25           ` Richard Earnshaw (lists)
2016-11-16 10:00             ` Jiong Wang
     [not found]               ` <1479304496.14569.256.camel@redhat.com>
2016-11-16 14:02                 ` Jakub Jelinek
2016-11-30 11:15                   ` Jiong Wang
2016-11-30 18:25                     ` Yao Qi
2016-12-12 13:40                     ` [Ping~][1/9][RFC][DWARF] " Jiong Wang
2016-12-19 13:59                       ` [Ping^2][1/9][RFC][DWARF] " Jiong Wang
2016-12-28 18:21                         ` [Ping^3][1/9][RFC][DWARF] " Jiong Wang
2016-12-28 19:54                     ` [1/9][RFC][DWARF] " Cary Coutant
2017-01-03  9:32                       ` Jiong Wang
2017-01-03 10:10                       ` Jiong Wang
2017-01-03 10:57                         ` Yao Qi
2017-01-03 15:21                           ` Nick Clifton
2017-01-03 17:47                             ` Yao Qi
2016-11-30 21:44                   ` Cary Coutant
2016-12-01 10:42                     ` Richard Earnshaw (lists)
2016-12-01 11:09                       ` Jiong Wang
2016-11-15 16:51         ` Jiong Wang
2016-12-28 19:48     ` Cary Coutant

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=72418e98-a400-c503-e8ce-c3fbe1ecc4a7@foss.arm.com \
    --to=jiong.wang@foss.arm.com \
    --cc=Richard.Earnshaw@arm.com \
    --cc=binutils@sourceware.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox