x86/debug: Handle early WARN_ONs proper

Hans managed to trigger a WARN very early in the boot which killed his
(Virtual) box.

The reason is that the recent rework of WARN() to use UD0 forgot to add the
fixup_bug() call to early_fixup_exception(). As a result the kernel does
not handle the WARN_ON injected UD0 exception and panics.

Add the missing fixup call, so early UD's injected by WARN() get handled.

Fixes: 9a93848fe787 ("x86/debug: Implement __WARN() using UD0")
Reported-and-tested-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Frank Mehnert <frank.mehnert@oracle.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Michael Thayer <michael.thayer@oracle.com>
Link: http://lkml.kernel.org/r/20170612180108.w4vgu2ckucmllf3a@hirez.programming.kicks-ass.net

authored by

Peter Zijlstra and committed by
Thomas Gleixner
8a524f80 32c1431e

+5 -1
+1
arch/x86/include/asm/extable.h
··· 29 29 } while (0) 30 30 31 31 extern int fixup_exception(struct pt_regs *regs, int trapnr); 32 + extern int fixup_bug(struct pt_regs *regs, int trapnr); 32 33 extern bool ex_has_fault_handler(unsigned long ip); 33 34 extern void early_fixup_exception(struct pt_regs *regs, int trapnr); 34 35
+1 -1
arch/x86/kernel/traps.c
··· 182 182 return ud == INSN_UD0 || ud == INSN_UD2; 183 183 } 184 184 185 - static int fixup_bug(struct pt_regs *regs, int trapnr) 185 + int fixup_bug(struct pt_regs *regs, int trapnr) 186 186 { 187 187 if (trapnr != X86_TRAP_UD) 188 188 return 0;
+3
arch/x86/mm/extable.c
··· 162 162 if (fixup_exception(regs, trapnr)) 163 163 return; 164 164 165 + if (fixup_bug(regs, trapnr)) 166 + return; 167 + 165 168 fail: 166 169 early_printk("PANIC: early exception 0x%02x IP %lx:%lx error %lx cr2 0x%lx\n", 167 170 (unsigned)trapnr, (unsigned long)regs->cs, regs->ip,