Commit 70579a86 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Ingo Molnar

x86/debug: Define BUG() again for !CONFIG_BUG

The latest change to the BUG() macro inadvertently reverted the earlier
commit:

  b06dd879 ("x86: always define BUG() and HAVE_ARCH_BUG, even with !CONFIG_BUG")

... that sanitized the behavior with CONFIG_BUG=n.

I noticed this as some warnings have appeared again that were previously
fixed as a side effect of that patch:

  kernel/seccomp.c: In function '__seccomp_filter':
  kernel/seccomp.c:670:1: error: no return statement in function returning non-void [-Werror=return-type]
  ...

This combines the two patches and uses the ud2 macro to define BUG()
in case of CONFIG_BUG=n.
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Josh Triplett <josh@joshtriplett.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: 9a93848f ("x86/debug: Implement __WARN() using UD0")
Link: http://lkml.kernel.org/r/20170329211646.2707365-1-arnd@arndb.deSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 9a93848f
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#define LEN_UD0 2 #define LEN_UD0 2
#ifdef CONFIG_GENERIC_BUG #ifdef CONFIG_GENERIC_BUG
#define HAVE_ARCH_BUG
#ifdef CONFIG_X86_32 #ifdef CONFIG_X86_32
# define __BUG_REL(val) ".long " __stringify(val) # define __BUG_REL(val) ".long " __stringify(val)
...@@ -64,6 +63,13 @@ do { \ ...@@ -64,6 +63,13 @@ do { \
#endif /* CONFIG_DEBUG_BUGVERBOSE */ #endif /* CONFIG_DEBUG_BUGVERBOSE */
#else
#define _BUG_FLAGS(ins, flags) asm volatile(ins)
#endif /* CONFIG_GENERIC_BUG */
#define HAVE_ARCH_BUG
#define BUG() \ #define BUG() \
do { \ do { \
_BUG_FLAGS(ASM_UD2, 0); \ _BUG_FLAGS(ASM_UD2, 0); \
...@@ -72,8 +78,6 @@ do { \ ...@@ -72,8 +78,6 @@ do { \
#define __WARN_TAINT(taint) _BUG_FLAGS(ASM_UD0, BUGFLAG_TAINT(taint)) #define __WARN_TAINT(taint) _BUG_FLAGS(ASM_UD0, BUGFLAG_TAINT(taint))
#endif /* CONFIG_GENERIC_BUG */
#include <asm-generic/bug.h> #include <asm-generic/bug.h>
#endif /* _ASM_X86_BUG_H */ #endif /* _ASM_X86_BUG_H */
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