x86/asm: Add ASM_UNREACHABLE
authorKees Cook <[email protected]>
Mon, 24 Jul 2017 18:35:48 +0000 (11:35 -0700)
committerIngo Molnar <[email protected]>
Tue, 25 Jul 2017 09:18:09 +0000 (11:18 +0200)
This creates an unreachable annotation in asm for CONFIG_STACK_VALIDATION=y.
While here, adjust earlier uses of \t\n into \n\t.

Suggested-by: Josh Poimboeuf <[email protected]>
Signed-off-by: Kees Cook <[email protected]>
Cc: Alexey Dobriyan <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Cc: David S. Miller <[email protected]>
Cc: Davidlohr Bueso <[email protected]>
Cc: Elena Reshetova <[email protected]>
Cc: Eric Biggers <[email protected]>
Cc: Eric W. Biederman <[email protected]>
Cc: Greg KH <[email protected]>
Cc: Hans Liljestrand <[email protected]>
Cc: James Bottomley <[email protected]>
Cc: Jann Horn <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Manfred Spraul <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Rik van Riel <[email protected]>
Cc: Serge E. Hallyn <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: linux-arch <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
include/linux/compiler-gcc.h
include/linux/compiler.h

index cd4bbe8242bd89802c0440329615c6c64fedbd69..179375b2d862c18dbdeb5f0d74fe466e5620e246 100644 (file)
 
 #ifdef CONFIG_STACK_VALIDATION
 #define annotate_unreachable() ({                                      \
-       asm("%c0:\t\n"                                                  \
-           ".pushsection .discard.unreachable\t\n"                     \
-           ".long %c0b - .\t\n"                                        \
-           ".popsection\t\n" : : "i" (__LINE__));                      \
+       asm("%c0:\n\t"                                                  \
+           ".pushsection .discard.unreachable\n\t"                     \
+           ".long %c0b - .\n\t"                                        \
+           ".popsection\n\t" : : "i" (__LINE__));                      \
 })
+#define ASM_UNREACHABLE                                                        \
+       "999:\n\t"                                                      \
+       ".pushsection .discard.unreachable\n\t"                         \
+       ".long 999b - .\n\t"                                            \
+       ".popsection\n\t"
 #else
 #define annotate_unreachable()
 #endif
index 219f82f3ec1a731c251b68e40623c01e3152f7eb..641f5912d75f96b8bf6c94fbde72e9b0bce92433 100644 (file)
@@ -185,6 +185,9 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
 #endif
 
 /* Unreachable code */
+#ifndef ASM_UNREACHABLE
+# define ASM_UNREACHABLE
+#endif
 #ifndef unreachable
 # define unreachable() do { } while (1)
 #endif