From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 115184 invoked by alias); 11 Nov 2016 18:22:00 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 115095 invoked by uid 89); 11 Nov 2016 18:21:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=BAYES_00,KAM_ASCII_DIVIDERS,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=proceeds, sk:richard, signing, richard.earnshaw@arm.com X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 11 Nov 2016 18:21:51 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3088E28; Fri, 11 Nov 2016 10:21:50 -0800 (PST) Received: from [10.2.206.198] (e104437-lin.cambridge.arm.com [10.2.206.198]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6F27C3F24D; Fri, 11 Nov 2016 10:21:49 -0800 (PST) From: Jiong Wang Subject: [1/9][RFC][DWARF] Reserve three DW_OP numbers in vendor extension space To: gcc-patches , gdb-patches@sourceware.org, Binutils References: Cc: "Richard Earnshaw (lists)" Message-ID: <72418e98-a400-c503-e8ce-c3fbe1ecc4a7@foss.arm.com> Date: Fri, 11 Nov 2016 18:22:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------5AEC20D3CE51E1B4891C1FDB" X-IsSubscribed: yes X-SW-Source: 2016-11/txt/msg01156.txt.bz2 This is a multi-part message in MIME format. --------------5AEC20D3CE51E1B4891C1FDB Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-length: 3591 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 Jiong Wang * 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. --------------5AEC20D3CE51E1B4891C1FDB Content-Type: text/x-patch; name="1.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="1.patch" Content-length: 958 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) --------------5AEC20D3CE51E1B4891C1FDB--