Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752639AbbGRQlF (ORCPT ); Sat, 18 Jul 2015 12:41:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33996 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751943AbbGRQlD (ORCPT ); Sat, 18 Jul 2015 12:41:03 -0400 Date: Sat, 18 Jul 2015 11:40:59 -0500 From: Josh Poimboeuf To: Linus Torvalds Cc: Michal Marek , Thomas Gleixner , Ingo Molnar , Borislav Petkov , linux-kernel@vger.kernel.org, Andi Kleen , Andy Lutomirski , Pedro Alves , live-patching@vger.kernel.org, x86@kernel.org, "H. Peter Anvin" , Peter Zijlstra Subject: Re: [RFC PATCH 02/21] stackvalidate: Add C version of STACKVALIDATE_IGNORE_INSN Message-ID: <20150718164059.GA24875@treble.redhat.com> References: <3696c19542f8a29d66735b894d5414f6a9860c98.1437150175.git.jpoimboe@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: 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: 1711 Lines: 63 On Sat, Jul 18, 2015 at 09:16:58AM -0700, Linus Torvalds wrote: > On Jul 17, 2015 09:57, "Josh Poimboeuf" wrote: > > > > + > > +#define STACKVALIDATE_IGNORE_INSN \ > > + ".Ltemp" __stringify(__LINE__) ":;" \ > > This is wrong. It won't work for people who do multiple of these on the > same line (think macros etc). > > For temporary labels, you should just use numeric labels. Think Pascal > style ones. Then use "b" or "f" after the number when referring to it to > say "back" or "forward" reference. > > So the code for an endless loop with a true temporary label looks like: > > 1: code > jmp 1b > > and a branch over would look like > > jne 7f > .. code ... > 7: ... > > and now you can have multiple of these truly temp labels without ever > getting errors from having a label redefined. Yeah, I think I'll change the C macro to do that. However for asm macros you have to worry about collisions. For example: .macro FOO 1: ... .endm 1: ... FOO jmp 1b It would jump to "1" in the macro instead of the "1" before the macro. So for the asm version of the macro I ended up using Andy's idea of using "\@" to get a unique identifier: .macro STACKVALIDATE_IGNORE_INSN .if CONFIG_STACK_VALIDATION .Ltemp_\@: .pushsection __stackvalidate_ignore_insn, "a" _ASM_ALIGN .long .Ltemp_\@ - . .popsection .endif .endm -- 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/