[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20150718164059.GA24875@treble.redhat.com>
Date: Sat, 18 Jul 2015 11:40:59 -0500
From: Josh Poimboeuf <jpoimboe@...hat.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Michal Marek <mmarek@...e.cz>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
linux-kernel@...r.kernel.org, Andi Kleen <andi@...stfloor.org>,
Andy Lutomirski <luto@...nel.org>,
Pedro Alves <palves@...hat.com>, live-patching@...r.kernel.org,
x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>,
Peter Zijlstra <peterz@...radead.org>
Subject: Re: [RFC PATCH 02/21] stackvalidate: Add C version of
STACKVALIDATE_IGNORE_INSN
On Sat, Jul 18, 2015 at 09:16:58AM -0700, Linus Torvalds wrote:
> On Jul 17, 2015 09:57, "Josh Poimboeuf" <jpoimboe@...hat.com> 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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists