Merge tag 'v3.10.105' into update
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / arch / arm64 / kernel / traps.c
index 7da4cb8d42f3b6a3631280236e81cbadfc7a1783..8e65005684b1afc9e7bc7ce8759909621e156ddd 100644 (file)
@@ -424,12 +424,11 @@ int register_async_abort_handler(void (*fn)(struct pt_regs *regs, void *), void
 #endif
 
 /*
- * bad_mode handles the impossible case in the exception vector.
+ * bad_mode handles the impossible case in the exception vector. This is always
+ * fatal.
  */
 asmlinkage void bad_mode(struct pt_regs *regs, int reason, unsigned int esr)
 {
-       siginfo_t info;
-       void __user *pc = (void __user *)instruction_pointer(regs);
        console_verbose();
 
 #ifdef CONFIG_MEDIATEK_SOLUTION
@@ -443,6 +442,24 @@ asmlinkage void bad_mode(struct pt_regs *regs, int reason, unsigned int esr)
 #endif
        pr_crit("Bad mode in %s handler detected, code 0x%08x\n",
                handler[reason], esr);
+
+       die("Oops - bad mode", regs, 0);
+       local_irq_disable();
+       panic("bad mode");
+}
+
+/*
+ * bad_el0_sync handles unexpected, but potentially recoverable synchronous
+ * exceptions taken from EL0. Unlike bad_mode, this returns.
+ */
+asmlinkage void bad_el0_sync(struct pt_regs *regs, int reason, unsigned int esr)
+{
+       siginfo_t info;
+       void __user *pc = (void __user *)instruction_pointer(regs);
+       console_verbose();
+
+       pr_crit("Bad EL0 synchronous exception detected on CPU%d, code 0x%08x\n",
+               smp_processor_id(), esr);
        __show_regs(regs);
 
        info.si_signo = SIGILL;
@@ -450,7 +467,7 @@ asmlinkage void bad_mode(struct pt_regs *regs, int reason, unsigned int esr)
        info.si_code  = ILL_ILLOPC;
        info.si_addr  = pc;
 
-       arm64_notify_die("Oops - bad mode", regs, &info, 0);
+       force_sig_info(info.si_signo, &info, current);
 }
 
 void __pte_error(const char *file, int line, unsigned long val)