From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753609AbbALTrQ (ORCPT ); Mon, 12 Jan 2015 14:47:16 -0500 Received: from mail-lb0-f171.google.com ([209.85.217.171]:50971 "EHLO mail-lb0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751569AbbALTrO (ORCPT ); Mon, 12 Jan 2015 14:47:14 -0500 MIME-Version: 1.0 In-Reply-To: <20150112193704.GG3904@pd.tnic> References: <1421017655-25561-1-git-send-email-dvlasenk@redhat.com> <20150112192314.GF3904@pd.tnic> <20150112193704.GG3904@pd.tnic> From: Andy Lutomirski Date: Mon, 12 Jan 2015 11:46:53 -0800 Message-ID: Subject: Re: [PATCH] x86: introduce push/pop macros which generate CFI_REL_OFFSET and CFI_RESTORE To: Borislav Petkov Cc: Denys Vlasenko , "linux-kernel@vger.kernel.org" , Linus Torvalds , Oleg Nesterov , "H. Peter Anvin" , 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 11:37 AM, Borislav Petkov wrote: > Andy, please trim your replies. > > On Mon, Jan 12, 2015 at 11:25:39AM -0800, Andy Lutomirski wrote: >> I think that some users don't want the CFI_REL_OFFSET. > > Why? I thought those two annotations are independent? As you said: > > "IOW, one is to keep the stack frame tracking consistent and the other > is to tell the unwinder about the register we just saved." > > Sounds to me like we want both... > Dumb example: pushq_cfi $__KERNEL_DS /* ss */ This doesn't save anything that the unwinder would care about. Better example: pushq_cfi \child_rip /* rip */ CFI_REL_OFFSET rip,0 Doing this with a macro would need a fancier macro. Then there's crap like: pushq_cfi %rdi SCHEDULE_USER popq_cfi %rdi I would need to look a lot more carefully to figure out whether this would need CFI_REL_OFFSET. If we actually had a DWARF unwinder in the kernel, maybe we could have real test cases :-/ --Andy