Re: [RFC PATCH 02/21] stackvalidate: Add C version of STACKVALIDATE_IGNORE_INSN

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Jul 18, 2015 at 09:16:58AM -0700, Linus Torvalds wrote:
> On Jul 17, 2015 09:57, "Josh Poimboeuf" <jpoimboe@xxxxxxxxxx> 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 live-patching" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux Kernel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux