Commit aa5d1b81 authored by Kees Cook's avatar Kees Cook Committed by Ingo Molnar

x86/asm: Add ASM_UNREACHABLE

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: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: David S. Miller <davem@davemloft.net>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: Elena Reshetova <elena.reshetova@intel.com>
Cc: Eric Biggers <ebiggers3@gmail.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Greg KH <gregkh@linuxfoundation.org>
Cc: Hans Liljestrand <ishkamiel@gmail.com>
Cc: James Bottomley <James.Bottomley@hansenpartnership.com>
Cc: Jann Horn <jannh@google.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Manfred Spraul <manfred@colorfullife.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rik van Riel <riel@redhat.com>
Cc: Serge E. Hallyn <serge@hallyn.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: arozansk@redhat.com
Cc: axboe@kernel.dk
Cc: kernel-hardening@lists.openwall.com
Cc: linux-arch <linux-arch@vger.kernel.org>
Link: http://lkml.kernel.org/r/1500921349-10803-3-git-send-email-keescook@chromium.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent df340524
...@@ -203,11 +203,16 @@ ...@@ -203,11 +203,16 @@
#ifdef CONFIG_STACK_VALIDATION #ifdef CONFIG_STACK_VALIDATION
#define annotate_unreachable() ({ \ #define annotate_unreachable() ({ \
asm("%c0:\t\n" \ asm("%c0:\n\t" \
".pushsection .discard.unreachable\t\n" \ ".pushsection .discard.unreachable\n\t" \
".long %c0b - .\t\n" \ ".long %c0b - .\n\t" \
".popsection\t\n" : : "i" (__LINE__)); \ ".popsection\n\t" : : "i" (__LINE__)); \
}) })
#define ASM_UNREACHABLE \
"999:\n\t" \
".pushsection .discard.unreachable\n\t" \
".long 999b - .\n\t" \
".popsection\n\t"
#else #else
#define annotate_unreachable() #define annotate_unreachable()
#endif #endif
......
...@@ -185,6 +185,9 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, ...@@ -185,6 +185,9 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
#endif #endif
/* Unreachable code */ /* Unreachable code */
#ifndef ASM_UNREACHABLE
# define ASM_UNREACHABLE
#endif
#ifndef unreachable #ifndef unreachable
# define unreachable() do { } while (1) # define unreachable() do { } while (1)
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment