From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15440 invoked by alias); 16 Nov 2016 14:02:37 -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 15396 invoked by uid 89); 16 Nov 2016 14:02:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.8 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2322 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 16 Nov 2016 14:02:26 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D1B5361E78; Wed, 16 Nov 2016 14:02:24 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-204-19.brq.redhat.com [10.40.204.19]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uAGE2NrU017879 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 16 Nov 2016 09:02:24 -0500 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id uAGE2K0D011742; Wed, 16 Nov 2016 15:02:21 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id uAGE2ILb011741; Wed, 16 Nov 2016 15:02:18 +0100 Date: Wed, 16 Nov 2016 14:02:00 -0000 From: Jakub Jelinek To: Mark Wielaard Cc: Jiong Wang , "Richard Earnshaw (lists)" , gcc-patches , gdb-patches@sourceware.org, Binutils Subject: Re: [1/9][RFC][DWARF] Reserve three DW_OP numbers in vendor extension space Message-ID: <20161116140218.GU3541@tucnak.redhat.com> Reply-To: Jakub Jelinek References: <72418e98-a400-c503-e8ce-c3fbe1ecc4a7@foss.arm.com> <20161111193859.GJ3541@tucnak.redhat.com> <20161115161817.GL3541@tucnak.redhat.com> <5896be40-51de-55f7-f4a1-4c5af7ff9aec@foss.arm.com> <1479304496.14569.256.camel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1479304496.14569.256.camel@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-SW-Source: 2016-11/txt/msg00412.txt.bz2 On Wed, Nov 16, 2016 at 02:54:56PM +0100, Mark Wielaard wrote: > On Wed, 2016-11-16 at 10:00 +0000, Jiong Wang wrote: > > The two operations DW_OP_AARCH64_paciasp and DW_OP_AARCH64_paciasp_deref were > > designed as shortcut operations when LR is signed with A key and using > > function's CFA as salt. This is the default behaviour of return address > > signing so is expected to be used for most of the time. DW_OP_AARCH64_pauth > > is designed as a generic operation that allow describing pointer signing on > > any value using any salt and key in case we can't use the shortcut operations > > we can use this. > > I admit to not fully understand the salting/keying involved. But given > that the DW_OP space is really tiny, so we would like to not eat up too > many of them for new opcodes. And given that introducing any new DW_OPs > using for CFI unwinding will break any unwinder anyway causing us to > update them all for this new feature. Have you thought about using a new > CIE augmentation string character for describing that the return > address/link register used by a function/frame is salted/keyed? > > This seems a good description of CIE records and augmentation > characters: http://www.airs.com/blog/archives/460 > > It obviously also involves updating all unwinders to understand the new > augmentation character (and possible arguments). But it might be more > generic and saves us from using up too many DW_OPs. >From what I understood, the return address is not always scrambled, so it doesn't apply to the whole function, just to most of it (except for an insn in the prologue and some in the epilogue). So I think one op is needed. But can't it be just a toggable flag whether the return address is scrambled + some arguments to it? Thus DW_OP_AARCH64_scramble .uleb128 0 would mean that the default way of scrambling starts here (if not already active) or any kind of scrambling ends here (if already active), and DW_OP_AARCH64_scramble .uleb128 non-zero would be whatever encoding you need to represent details of the less common variants with details what to do. Then you'd just hook through some MD_* macro in the unwinder the descrambling operation if the scrambling is active at the insns you unwind on. Jakub