From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752948AbbALU1F (ORCPT ); Mon, 12 Jan 2015 15:27:05 -0500 Received: from mail-lb0-f179.google.com ([209.85.217.179]:40201 "EHLO mail-lb0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752403AbbALU1A (ORCPT ); Mon, 12 Jan 2015 15:27:00 -0500 MIME-Version: 1.0 In-Reply-To: <54B42CF2.2030104@zytor.com> References: <1421017655-25561-1-git-send-email-dvlasenk@redhat.com> <20150112192314.GF3904@pd.tnic> <20150112193704.GG3904@pd.tnic> <20150112201145.GH3904@pd.tnic> <54B42CF2.2030104@zytor.com> From: Andy Lutomirski Date: Mon, 12 Jan 2015 12:26:38 -0800 Message-ID: Subject: Re: [PATCH] x86: introduce push/pop macros which generate CFI_REL_OFFSET and CFI_RESTORE To: "H. Peter Anvin" Cc: Borislav Petkov , Denys Vlasenko , "linux-kernel@vger.kernel.org" , Linus Torvalds , Oleg Nesterov , Frederic Weisbecker , X86 ML , Alexei Starovoitov , Will Drewry , Kees Cook Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 12, 2015 at 12:22 PM, H. Peter Anvin wrote: > On 01/12/2015 12:14 PM, Andy Lutomirski wrote: >> On Mon, Jan 12, 2015 at 12:11 PM, Borislav Petkov wrote: >>> On Mon, Jan 12, 2015 at 11:46:53AM -0800, Andy Lutomirski wrote: >>>> Dumb example: >>>> >>>> pushq_cfi $__KERNEL_DS /* ss */ >>>> >>>> This doesn't save anything that the unwinder would care about. >>> >>> And? The unwinder or whatever looks at that info simply ignores stuff it >>> is not interested in, no? >> >> But CFI_REL_OFFSET $__KERNEL_DS, 0 probably isn't even well-formed and >> won't build. >> > > I think this is relatively easy to deal with at the expense of a large > .ifeq statement in the macro. > > Is the usage you have in mind something like: pushq_cfi %r11 /* saves r11 */ pushq_cfi $0 /* saves nothing */ pushq_cfi %r11, savereg=rip /* saves rip */ I think I prefer the somewhat less magical: pushq_reg_cfi %r11 /* saves r11 */ pushq_reg_cfi %r11, savereg=rip /* saves rip */ pushq_nounwind_cfi $0 Or something like that. --Andy -hpa > > -- Andy Lutomirski AMA Capital Management, LLC