From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751277AbdFAPBk (ORCPT ); Thu, 1 Jun 2017 11:01:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43624 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751091AbdFAPBj (ORCPT ); Thu, 1 Jun 2017 11:01:39 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7D87283F42 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jpoimboe@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 7D87283F42 Date: Thu, 1 Jun 2017 10:01:37 -0500 From: Josh Poimboeuf To: Andy Lutomirski Cc: X86 ML , "linux-kernel@vger.kernel.org" , live-patching@vger.kernel.org, Linus Torvalds , Jiri Slaby , Ingo Molnar , "H. Peter Anvin" , Peter Zijlstra Subject: Re: [RFC PATCH 06/10] x86/entry: add CFI hint undwarf annotations Message-ID: <20170601150137.r3e2gpqusjjhtg6y@treble> References: <1d852057ba39f2f5f02f196c604b8baecce33fea.1496293620.git.jpoimboe@redhat.com> <20170601142358.wvasu35pvyyvjt2r@treble> <20170601142858.na6iph4ihpgcgold@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.0.1 (2016-04-01) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 01 Jun 2017 15:01:38 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 01, 2017 at 07:39:38AM -0700, Andy Lutomirski wrote: > On Thu, Jun 1, 2017 at 7:28 AM, Josh Poimboeuf wrote: > > On Thu, Jun 01, 2017 at 09:23:58AM -0500, Josh Poimboeuf wrote: > >> On Thu, Jun 01, 2017 at 07:03:18AM -0700, Andy Lutomirski wrote: > >> > On Wed, May 31, 2017 at 10:44 PM, Josh Poimboeuf wrote: > >> > Just to make sure I understand this, if we unwind from... > >> > > >> > > @@ -112,6 +114,7 @@ For 32-bit we have the following conventions - kernel is built with > >> > > movq %rdx, 12*8+\offset(%rsp) > >> > > movq %rsi, 13*8+\offset(%rsp) > >> > > >> > ...here..., will objtool think that rdx and rsi (etc) still live in > >> > their respective regs, or will it find them in the on-stack data given > >> > by CFI_REGS? If the former, how does undwarf deal with the > >> > corresponding pops? > >> > >> It will find them in their respective registers, which is fine because > >> they haven't been clobbered yet. > > > > Sorry, I hit send too soon. Which pops are you referring to? > > > > If we do push, push, push, CFI_REGS, and then, later, we pop all those > saved regs, how does undwarf figure out that those pops are moving a > saved reg from the stack back to a register? Is objtool just that > smart, or did I fail to notice an annotation somewhere, or does it not > matter? RESTORE_EXTRA_REGS has an annotation that attempts to do that, though CFI_REGS ignores the 'extra' arg so there's a bug there. It should resolve to a CFI_IRET_REGS annotation with an offset because the unwinder doesn't care about C regs. I'll fix that and make the save/restore annotations more symmetrical. -- Josh