summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorJosh Poimboeuf <jpoimboe@redhat.com>2017-07-15 01:10:58 -0400
committerIngo Molnar <mingo@kernel.org>2017-07-20 06:31:04 -0400
commit325cdacd03c12629aa5f9ee2ace49b1f3dc184a8 (patch)
treef9bafe49be8aa9e98a0afb4a4a4009e5d4a7561f /arch
parent095f6d76221dd4b99d004e4c826ac4382c6ce5e3 (diff)
debug: Fix WARN_ON_ONCE() for modules
Mike Galbraith reported a situation where a WARN_ON_ONCE() call in DRM code turned into an oops. As it turns out, WARN_ON_ONCE() seems to be completely broken when called from a module. The bug was introduced with the following commit: 19d436268dde ("debug: Add _ONCE() logic to report_bug()") That commit changed WARN_ON_ONCE() to move its 'once' logic into the bug trap handler. It requires a writable bug table so that the BUGFLAG_DONE bit can be written to the flags to indicate the first warning has occurred. The bug table was made writable for vmlinux, which relies on vmlinux.lds.S and vmlinux.lds.h for laying out the sections. However, it wasn't made writable for modules, which rely on the ELF section header flags. Reported-by: Mike Galbraith <efault@gmx.de> Tested-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Fixes: 19d436268dde ("debug: Add _ONCE() logic to report_bug()") Link: http://lkml.kernel.org/r/a53b04235a65478dd9afc51f5b329fdc65c84364.1500095401.git.jpoimboe@redhat.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/include/asm/bug.h2
-rw-r--r--arch/arm64/include/asm/bug.h2
-rw-r--r--arch/blackfin/include/asm/bug.h4
-rw-r--r--arch/mn10300/include/asm/bug.h2
-rw-r--r--arch/parisc/include/asm/bug.h6
-rw-r--r--arch/powerpc/include/asm/bug.h8
-rw-r--r--arch/s390/include/asm/bug.h4
-rw-r--r--arch/sh/include/asm/bug.h4
-rw-r--r--arch/x86/include/asm/bug.h4
9 files changed, 18 insertions, 18 deletions
diff --git a/arch/arm/include/asm/bug.h b/arch/arm/include/asm/bug.h
index 4e6e88a6b2f4..2244a94ed9c9 100644
--- a/arch/arm/include/asm/bug.h
+++ b/arch/arm/include/asm/bug.h
@@ -37,7 +37,7 @@ do { \
37 ".pushsection .rodata.str, \"aMS\", %progbits, 1\n" \ 37 ".pushsection .rodata.str, \"aMS\", %progbits, 1\n" \
38 "2:\t.asciz " #__file "\n" \ 38 "2:\t.asciz " #__file "\n" \
39 ".popsection\n" \ 39 ".popsection\n" \
40 ".pushsection __bug_table,\"a\"\n" \ 40 ".pushsection __bug_table,\"aw\"\n" \
41 ".align 2\n" \ 41 ".align 2\n" \
42 "3:\t.word 1b, 2b\n" \ 42 "3:\t.word 1b, 2b\n" \
43 "\t.hword " #__line ", 0\n" \ 43 "\t.hword " #__line ", 0\n" \
diff --git a/arch/arm64/include/asm/bug.h b/arch/arm64/include/asm/bug.h
index 366448eb0fb7..a02a57186f56 100644
--- a/arch/arm64/include/asm/bug.h
+++ b/arch/arm64/include/asm/bug.h
@@ -36,7 +36,7 @@
36#ifdef CONFIG_GENERIC_BUG 36#ifdef CONFIG_GENERIC_BUG
37 37
38#define __BUG_ENTRY(flags) \ 38#define __BUG_ENTRY(flags) \
39 ".pushsection __bug_table,\"a\"\n\t" \ 39 ".pushsection __bug_table,\"aw\"\n\t" \
40 ".align 2\n\t" \ 40 ".align 2\n\t" \
41 "0: .long 1f - 0b\n\t" \ 41 "0: .long 1f - 0b\n\t" \
42_BUGVERBOSE_LOCATION(__FILE__, __LINE__) \ 42_BUGVERBOSE_LOCATION(__FILE__, __LINE__) \
diff --git a/arch/blackfin/include/asm/bug.h b/arch/blackfin/include/asm/bug.h
index 8d9b1eba89c4..76b2e82ee730 100644
--- a/arch/blackfin/include/asm/bug.h
+++ b/arch/blackfin/include/asm/bug.h
@@ -21,7 +21,7 @@
21#define _BUG_OR_WARN(flags) \ 21#define _BUG_OR_WARN(flags) \
22 asm volatile( \ 22 asm volatile( \
23 "1: .hword %0\n" \ 23 "1: .hword %0\n" \
24 " .section __bug_table,\"a\",@progbits\n" \ 24 " .section __bug_table,\"aw\",@progbits\n" \
25 "2: .long 1b\n" \ 25 "2: .long 1b\n" \
26 " .long %1\n" \ 26 " .long %1\n" \
27 " .short %2\n" \ 27 " .short %2\n" \
@@ -38,7 +38,7 @@
38#define _BUG_OR_WARN(flags) \ 38#define _BUG_OR_WARN(flags) \
39 asm volatile( \ 39 asm volatile( \
40 "1: .hword %0\n" \ 40 "1: .hword %0\n" \
41 " .section __bug_table,\"a\",@progbits\n" \ 41 " .section __bug_table,\"aw\",@progbits\n" \
42 "2: .long 1b\n" \ 42 "2: .long 1b\n" \
43 " .short %1\n" \ 43 " .short %1\n" \
44 " .org 2b + %2\n" \ 44 " .org 2b + %2\n" \
diff --git a/arch/mn10300/include/asm/bug.h b/arch/mn10300/include/asm/bug.h
index aa6a38886391..811414fb002d 100644
--- a/arch/mn10300/include/asm/bug.h
+++ b/arch/mn10300/include/asm/bug.h
@@ -21,7 +21,7 @@ do { \
21 asm volatile( \ 21 asm volatile( \
22 " syscall 15 \n" \ 22 " syscall 15 \n" \
23 "0: \n" \ 23 "0: \n" \
24 " .section __bug_table,\"a\" \n" \ 24 " .section __bug_table,\"aw\" \n" \
25 " .long 0b,%0,%1 \n" \ 25 " .long 0b,%0,%1 \n" \
26 " .previous \n" \ 26 " .previous \n" \
27 : \ 27 : \
diff --git a/arch/parisc/include/asm/bug.h b/arch/parisc/include/asm/bug.h
index d2742273a685..07ea467f22fc 100644
--- a/arch/parisc/include/asm/bug.h
+++ b/arch/parisc/include/asm/bug.h
@@ -27,7 +27,7 @@
27 do { \ 27 do { \
28 asm volatile("\n" \ 28 asm volatile("\n" \
29 "1:\t" PARISC_BUG_BREAK_ASM "\n" \ 29 "1:\t" PARISC_BUG_BREAK_ASM "\n" \
30 "\t.pushsection __bug_table,\"a\"\n" \ 30 "\t.pushsection __bug_table,\"aw\"\n" \
31 "2:\t" ASM_WORD_INSN "1b, %c0\n" \ 31 "2:\t" ASM_WORD_INSN "1b, %c0\n" \
32 "\t.short %c1, %c2\n" \ 32 "\t.short %c1, %c2\n" \
33 "\t.org 2b+%c3\n" \ 33 "\t.org 2b+%c3\n" \
@@ -50,7 +50,7 @@
50 do { \ 50 do { \
51 asm volatile("\n" \ 51 asm volatile("\n" \
52 "1:\t" PARISC_BUG_BREAK_ASM "\n" \ 52 "1:\t" PARISC_BUG_BREAK_ASM "\n" \
53 "\t.pushsection __bug_table,\"a\"\n" \ 53 "\t.pushsection __bug_table,\"aw\"\n" \
54 "2:\t" ASM_WORD_INSN "1b, %c0\n" \ 54 "2:\t" ASM_WORD_INSN "1b, %c0\n" \
55 "\t.short %c1, %c2\n" \ 55 "\t.short %c1, %c2\n" \
56 "\t.org 2b+%c3\n" \ 56 "\t.org 2b+%c3\n" \
@@ -64,7 +64,7 @@
64 do { \ 64 do { \
65 asm volatile("\n" \ 65 asm volatile("\n" \
66 "1:\t" PARISC_BUG_BREAK_ASM "\n" \ 66 "1:\t" PARISC_BUG_BREAK_ASM "\n" \
67 "\t.pushsection __bug_table,\"a\"\n" \ 67 "\t.pushsection __bug_table,\"aw\"\n" \
68 "2:\t" ASM_WORD_INSN "1b\n" \ 68 "2:\t" ASM_WORD_INSN "1b\n" \
69 "\t.short %c0\n" \ 69 "\t.short %c0\n" \
70 "\t.org 2b+%c1\n" \ 70 "\t.org 2b+%c1\n" \
diff --git a/arch/powerpc/include/asm/bug.h b/arch/powerpc/include/asm/bug.h
index 0151af6c2a50..87fcc1948817 100644
--- a/arch/powerpc/include/asm/bug.h
+++ b/arch/powerpc/include/asm/bug.h
@@ -18,7 +18,7 @@
18#include <asm/asm-offsets.h> 18#include <asm/asm-offsets.h>
19#ifdef CONFIG_DEBUG_BUGVERBOSE 19#ifdef CONFIG_DEBUG_BUGVERBOSE
20.macro EMIT_BUG_ENTRY addr,file,line,flags 20.macro EMIT_BUG_ENTRY addr,file,line,flags
21 .section __bug_table,"a" 21 .section __bug_table,"aw"
225001: PPC_LONG \addr, 5002f 225001: PPC_LONG \addr, 5002f
23 .short \line, \flags 23 .short \line, \flags
24 .org 5001b+BUG_ENTRY_SIZE 24 .org 5001b+BUG_ENTRY_SIZE
@@ -29,7 +29,7 @@
29.endm 29.endm
30#else 30#else
31.macro EMIT_BUG_ENTRY addr,file,line,flags 31.macro EMIT_BUG_ENTRY addr,file,line,flags
32 .section __bug_table,"a" 32 .section __bug_table,"aw"
335001: PPC_LONG \addr 335001: PPC_LONG \addr
34 .short \flags 34 .short \flags
35 .org 5001b+BUG_ENTRY_SIZE 35 .org 5001b+BUG_ENTRY_SIZE
@@ -42,14 +42,14 @@
42 sizeof(struct bug_entry), respectively */ 42 sizeof(struct bug_entry), respectively */
43#ifdef CONFIG_DEBUG_BUGVERBOSE 43#ifdef CONFIG_DEBUG_BUGVERBOSE
44#define _EMIT_BUG_ENTRY \ 44#define _EMIT_BUG_ENTRY \
45 ".section __bug_table,\"a\"\n" \ 45 ".section __bug_table,\"aw\"\n" \
46 "2:\t" PPC_LONG "1b, %0\n" \ 46 "2:\t" PPC_LONG "1b, %0\n" \
47 "\t.short %1, %2\n" \ 47 "\t.short %1, %2\n" \
48 ".org 2b+%3\n" \ 48 ".org 2b+%3\n" \
49 ".previous\n" 49 ".previous\n"
50#else 50#else
51#define _EMIT_BUG_ENTRY \ 51#define _EMIT_BUG_ENTRY \
52 ".section __bug_table,\"a\"\n" \ 52 ".section __bug_table,\"aw\"\n" \
53 "2:\t" PPC_LONG "1b\n" \ 53 "2:\t" PPC_LONG "1b\n" \
54 "\t.short %2\n" \ 54 "\t.short %2\n" \
55 ".org 2b+%3\n" \ 55 ".org 2b+%3\n" \
diff --git a/arch/s390/include/asm/bug.h b/arch/s390/include/asm/bug.h
index 1bbd9dbfe4e0..ce9cc123988b 100644
--- a/arch/s390/include/asm/bug.h
+++ b/arch/s390/include/asm/bug.h
@@ -14,7 +14,7 @@
14 ".section .rodata.str,\"aMS\",@progbits,1\n" \ 14 ".section .rodata.str,\"aMS\",@progbits,1\n" \
15 "2: .asciz \""__FILE__"\"\n" \ 15 "2: .asciz \""__FILE__"\"\n" \
16 ".previous\n" \ 16 ".previous\n" \
17 ".section __bug_table,\"a\"\n" \ 17 ".section __bug_table,\"aw\"\n" \
18 "3: .long 1b-3b,2b-3b\n" \ 18 "3: .long 1b-3b,2b-3b\n" \
19 " .short %0,%1\n" \ 19 " .short %0,%1\n" \
20 " .org 3b+%2\n" \ 20 " .org 3b+%2\n" \
@@ -30,7 +30,7 @@
30 asm volatile( \ 30 asm volatile( \
31 "0: j 0b+2\n" \ 31 "0: j 0b+2\n" \
32 "1:\n" \ 32 "1:\n" \
33 ".section __bug_table,\"a\"\n" \ 33 ".section __bug_table,\"aw\"\n" \
34 "2: .long 1b-2b\n" \ 34 "2: .long 1b-2b\n" \
35 " .short %0\n" \ 35 " .short %0\n" \
36 " .org 2b+%1\n" \ 36 " .org 2b+%1\n" \
diff --git a/arch/sh/include/asm/bug.h b/arch/sh/include/asm/bug.h
index 1b77f068be2b..986c8781d89f 100644
--- a/arch/sh/include/asm/bug.h
+++ b/arch/sh/include/asm/bug.h
@@ -24,14 +24,14 @@
24 */ 24 */
25#ifdef CONFIG_DEBUG_BUGVERBOSE 25#ifdef CONFIG_DEBUG_BUGVERBOSE
26#define _EMIT_BUG_ENTRY \ 26#define _EMIT_BUG_ENTRY \
27 "\t.pushsection __bug_table,\"a\"\n" \ 27 "\t.pushsection __bug_table,\"aw\"\n" \
28 "2:\t.long 1b, %O1\n" \ 28 "2:\t.long 1b, %O1\n" \
29 "\t.short %O2, %O3\n" \ 29 "\t.short %O2, %O3\n" \
30 "\t.org 2b+%O4\n" \ 30 "\t.org 2b+%O4\n" \
31 "\t.popsection\n" 31 "\t.popsection\n"
32#else 32#else
33#define _EMIT_BUG_ENTRY \ 33#define _EMIT_BUG_ENTRY \
34 "\t.pushsection __bug_table,\"a\"\n" \ 34 "\t.pushsection __bug_table,\"aw\"\n" \
35 "2:\t.long 1b\n" \ 35 "2:\t.long 1b\n" \
36 "\t.short %O3\n" \ 36 "\t.short %O3\n" \
37 "\t.org 2b+%O4\n" \ 37 "\t.org 2b+%O4\n" \
diff --git a/arch/x86/include/asm/bug.h b/arch/x86/include/asm/bug.h
index 39e702d90cdb..aa6b2023d8f8 100644
--- a/arch/x86/include/asm/bug.h
+++ b/arch/x86/include/asm/bug.h
@@ -35,7 +35,7 @@
35#define _BUG_FLAGS(ins, flags) \ 35#define _BUG_FLAGS(ins, flags) \
36do { \ 36do { \
37 asm volatile("1:\t" ins "\n" \ 37 asm volatile("1:\t" ins "\n" \
38 ".pushsection __bug_table,\"a\"\n" \ 38 ".pushsection __bug_table,\"aw\"\n" \
39 "2:\t" __BUG_REL(1b) "\t# bug_entry::bug_addr\n" \ 39 "2:\t" __BUG_REL(1b) "\t# bug_entry::bug_addr\n" \
40 "\t" __BUG_REL(%c0) "\t# bug_entry::file\n" \ 40 "\t" __BUG_REL(%c0) "\t# bug_entry::file\n" \
41 "\t.word %c1" "\t# bug_entry::line\n" \ 41 "\t.word %c1" "\t# bug_entry::line\n" \
@@ -52,7 +52,7 @@ do { \
52#define _BUG_FLAGS(ins, flags) \ 52#define _BUG_FLAGS(ins, flags) \
53do { \ 53do { \
54 asm volatile("1:\t" ins "\n" \ 54 asm volatile("1:\t" ins "\n" \
55 ".pushsection __bug_table,\"a\"\n" \ 55 ".pushsection __bug_table,\"aw\"\n" \
56 "2:\t" __BUG_REL(1b) "\t# bug_entry::bug_addr\n" \ 56 "2:\t" __BUG_REL(1b) "\t# bug_entry::bug_addr\n" \
57 "\t.word %c0" "\t# bug_entry::flags\n" \ 57 "\t.word %c0" "\t# bug_entry::flags\n" \
58 "\t.org 2b+%c1\n" \ 58 "\t.org 2b+%c1\n" \