Skip to content

Commit aa5d1b8

Browse files
keesIngo Molnar
authored andcommitted
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: 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]>
1 parent df34052 commit aa5d1b8

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

include/linux/compiler-gcc.h

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,16 @@
203203

204204
#ifdef CONFIG_STACK_VALIDATION
205205
#define annotate_unreachable() ({ \
206-
asm("%c0:\t\n" \
207-
".pushsection .discard.unreachable\t\n" \
208-
".long %c0b - .\t\n" \
209-
".popsection\t\n" : : "i" (__LINE__)); \
206+
asm("%c0:\n\t" \
207+
".pushsection .discard.unreachable\n\t" \
208+
".long %c0b - .\n\t" \
209+
".popsection\n\t" : : "i" (__LINE__)); \
210210
})
211+
#define ASM_UNREACHABLE \
212+
"999:\n\t" \
213+
".pushsection .discard.unreachable\n\t" \
214+
".long 999b - .\n\t" \
215+
".popsection\n\t"
211216
#else
212217
#define annotate_unreachable()
213218
#endif

include/linux/compiler.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,9 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
185185
#endif
186186

187187
/* Unreachable code */
188+
#ifndef ASM_UNREACHABLE
189+
# define ASM_UNREACHABLE
190+
#endif
188191
#ifndef unreachable
189192
# define unreachable() do { } while (1)
190193
#endif

0 commit comments

Comments
 (0)