Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932924AbbFJSkp (ORCPT ); Wed, 10 Jun 2015 14:40:45 -0400 Received: from jablonecka.jablonka.cz ([91.219.244.36]:58273 "EHLO jablonecka.jablonka.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750917AbbFJSkh (ORCPT ); Wed, 10 Jun 2015 14:40:37 -0400 X-Greylist: delayed 1417 seconds by postgrey-1.27 at vger.kernel.org; Wed, 10 Jun 2015 14:40:37 EDT Date: Wed, 10 Jun 2015 20:16:51 +0200 From: Vojtech Pavlik To: Andy Lutomirski Cc: Josh Poimboeuf , 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: <20150610181650.GA11579@suse.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Bounce-Cookie: It's a lemon tree, dear Watson! User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1419 Lines: 32 On Wed, Jun 10, 2015 at 10:21:36AM -0700, Andy Lutomirski wrote: > On Jun 10, 2015 5:07 AM, "Josh Poimboeuf" wrote: > > > > Add a new CONFIG_ASM_VALIDATION option which adds an asmvalidate host > > tool which runs on every compiled .S file. Its goal is to enforce sane > > rules on all asm code, so that stack debug metadata (frame/back chain > > pointers and/or DWARF CFI metadata) can be made reliable. > > > > It enforces the following rules: > > > > 1. Each callable function must be annotated with the ELF STT_FUNC type. > > This is typically done using the ENTRY/ENDPROC macros. If > > asmvalidate finds a return instruction outside of a function, it > > flags an error, since that usually indicates callable code which > > should be annotated accordingly. > > > > 2. Each callable function must never leave its own bounds (i.e. with a > > jump to outside the function) except when returning. > > Won't that break with sibling/tail calls? GCC can generate those, and > the ia32_ptregs_common label is an example of such a thing. It only validates hand-written assembly, so how it could? -- Vojtech Pavlik Director SUSE Labs -- 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/