Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754854AbbFKOKG (ORCPT ); Thu, 11 Jun 2015 10:10:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54356 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754632AbbFKOKC (ORCPT ); Thu, 11 Jun 2015 10:10:02 -0400 Date: Thu, 11 Jun 2015 09:10:00 -0500 From: Josh Poimboeuf To: Ingo Molnar Cc: Andy Lutomirski , Michal Marek , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "linux-kernel@vger.kernel.org" , Andi Kleen , live-patching@vger.kernel.org, X86 ML , "H. Peter Anvin" , Linus Torvalds , Peter Zijlstra Subject: Re: [PATCH v5 02/10] x86: Compile-time asm code validation Message-ID: <20150611141000.GC11517@treble.redhat.com> References: <20150610175320.GD29724@treble.redhat.com> <20150610185845.GA1125@treble.redhat.com> <20150611061050.GB30720@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20150611061050.GB30720@gmail.com> User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1576 Lines: 31 On Thu, Jun 11, 2015 at 08:10:50AM +0200, Ingo Molnar wrote: > * Josh Poimboeuf wrote: > > > I imagine that an automatic CFI annotation adder would walk through functions > > > one instruction at a time and keep track of the frame state. If so, then it > > > could verify that common jump targets had identical state and continue walking > > > through them and annotating. I think this would get this case right, and it > > > might be necessary anyway to handle jumps within functions. > > > > This would definitely add complexity to both asmvalidate and the CFI generator. > > In fact it sounds like it would push the CFI generator out of its current awk > > script territory and more into complex C code territory. > > I'd count that as a plus: awk isn't a common skillset while C is, and properly > written it doesn't have to be _that_ complex. The thing is, C is quite painful for text processing. And I think we'd have to do the analysis at the source text level in order to generate the .cfi_* instructions to pass to the gnu assembler. C would definitely make more sense when analyzing object code. In fact, asmvalidate is written in C. But then I guess we'd have to re-implement the .cfi stuff and populate the DWARF sections manually instead of letting the assembler do it. -- Josh -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/