Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754444AbbFLQlG (ORCPT ); Fri, 12 Jun 2015 12:41:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60572 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752442AbbFLQlE (ORCPT ); Fri, 12 Jun 2015 12:41:04 -0400 Date: Fri, 12 Jun 2015 11:41:01 -0500 From: Josh Poimboeuf To: Pedro Alves Cc: Ingo Molnar , 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: <20150612164101.GA17611@treble.redhat.com> References: <20150610175320.GD29724@treble.redhat.com> <20150610185845.GA1125@treble.redhat.com> <20150611061050.GB30720@gmail.com> <20150611141000.GC11517@treble.redhat.com> <557ABFF8.5040304@redhat.com> <20150612141030.GA18807@treble.hsd1.ky.comcast.net> <557B0232.50108@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <557B0232.50108@redhat.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: 1343 Lines: 29 On Fri, Jun 12, 2015 at 05:00:50PM +0100, Pedro Alves wrote: > On 06/12/2015 03:10 PM, Josh Poimboeuf wrote: > > That said, the kernel has much more custom features than other projects. > > There are some sneaky macros, like _ASM_EXTABLE and ALTERNATIVE, which > > hide code in various sections. Unless we're able to somehow either stop > > using these macros or isolate them to a few places, I doubt that such a > > general purpose assembler option would work. > > How does the asmvalidator handle these? They're not easy to deal with... The ALTERNATIVE macro creates some instructions which can be patched in at runtime, to replace some original instructions, if the CPU supports certain features. So we have to look up those replacement instructions in another section and consider them to be potentially part of the original function when doing the analysis and generation. The _ASM_EXTABLE macro creates code which is executed after an exception. Similarly to the ALTERNATIVE macro, we have to look up those instructions and consider them to be part of the original function. -- 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/