From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 82224 invoked by alias); 21 Apr 2017 18:33:21 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 81600 invoked by uid 89); 21 Apr 2017 18:33:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=signing, critical 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, 21 Apr 2017 18:33:17 +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 C98FD344; Fri, 21 Apr 2017 07:56:51 -0700 (PDT) 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 58E133F3E1; Fri, 21 Apr 2017 07:56:51 -0700 (PDT) Subject: Re: [Patch] New gdbarch method "dwarf_cfa_op" and migrate SPARC to it To: Ivo Raisr , GDB References: From: Jiong Wang Message-ID: <1d0d97ca-b503-0303-5efc-600db754bd27@foss.arm.com> Date: Fri, 21 Apr 2017 18:33:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2017-04/txt/msg00617.txt.bz2 On 21/04/17 15:43, Ivo Raisr wrote: > > > On 19.4.2017 12:17, Jiong Wang wrote: >> Hi, >> >> Recently a feature called "return address signing" has been added to >> GCC to >> prevent stack smash stack on AArch64. For details please refer: >> >> https://gcc.gnu.org/ml/gcc-patches/2017-01/msg00376.html >> >> GDB needs to be aware of this feature so it can restore the original >> return >> address which is critical for unwinding. >> >> On compiler side, whenever return address, i.e. LR register, is >> mangled or >> restored by hardware instruction, compiler is expected to generate a >> DW_CFA_GNU_window_save CFA instruction to toggle the LR signing status. >> DW_CFA_GNU_window_save was introduced by SPARC for their register window >> feature, here AArch64 want to multiplex this DWARF CFA instruction as >> it's in vendor space. So, a new gdbarch method, dwarf_cfa_op, is >> introduced. > > Are you sure to reuse DW_CFA_GNU_window_save for AArch64 purposes? > Because semantics of DW_CFA_GNU_window_save (implied from "window > save") mean much more than just fiddling with return address. For > example as you learned from dwarf2-frame.c, whole register window > needs to be copied. Hi Ivo, Thanks very much for testing this on SPARC platform. What's really reused is the DWARF CFA number 0x2d behind DW_CFA_GNU_window_save. It is in vendor extension space ( DW_CFA_lo_user.. DW_CFA_hi_user) so the semantics depends on vendor interpreation. Regards, Jiong.