[POWERPC] 4xx: Workaround for the 440EP(x)/GR(x) processors identical PVR issue.
[safe/jmp/linux-2.6] / kernel / panic.c
index cc2a4c9..6f6e03e 100644 (file)
@@ -8,7 +8,6 @@
  * This function is used through-out the kernel (including mm and fs)
  * to indicate a major problem.
  */
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/delay.h>
@@ -19,6 +18,7 @@
 #include <linux/interrupt.h>
 #include <linux/nmi.h>
 #include <linux/kexec.h>
+#include <linux/debug_locks.h>
 
 int panic_on_oops;
 int tainted;
@@ -56,14 +56,14 @@ EXPORT_SYMBOL(panic_blink);
  *
  *     This function never returns.
  */
+
 NORET_TYPE void panic(const char * fmt, ...)
 {
        long i;
        static char buf[1024];
        va_list args;
 #if defined(CONFIG_S390)
-        unsigned long caller = (unsigned long) __builtin_return_address(0);
+       unsigned long caller = (unsigned long) __builtin_return_address(0);
 #endif
 
        /*
@@ -128,7 +128,7 @@ NORET_TYPE void panic(const char * fmt, ...)
        }
 #endif
 #if defined(CONFIG_S390)
-        disabled_wait(caller);
+       disabled_wait(caller);
 #endif
        local_irq_enable();
        for (i = 0;;) {
@@ -148,23 +148,26 @@ EXPORT_SYMBOL(panic);
  *  'F' - Module has been forcibly loaded.
  *  'S' - SMP with CPUs not designed for SMP.
  *  'R' - User forced a module unload.
- *  'M' - Machine had a machine check experience.
+ *  'M' - System experienced a machine check exception.
  *  'B' - System has hit bad_page.
+ *  'U' - Userspace-defined naughtiness.
  *
  *     The string is overwritten by the next call to print_taint().
  */
+
 const char *print_tainted(void)
 {
        static char buf[20];
        if (tainted) {
-               snprintf(buf, sizeof(buf), "Tainted: %c%c%c%c%c%c",
+               snprintf(buf, sizeof(buf), "Tainted: %c%c%c%c%c%c%c%c",
                        tainted & TAINT_PROPRIETARY_MODULE ? 'P' : 'G',
                        tainted & TAINT_FORCED_MODULE ? 'F' : ' ',
                        tainted & TAINT_UNSAFE_SMP ? 'S' : ' ',
                        tainted & TAINT_FORCED_RMMOD ? 'R' : ' ',
-                       tainted & TAINT_MACHINE_CHECK ? 'M' : ' ',
-                       tainted & TAINT_BAD_PAGE ? 'B' : ' ');
+                       tainted & TAINT_MACHINE_CHECK ? 'M' : ' ',
+                       tainted & TAINT_BAD_PAGE ? 'B' : ' ',
+                       tainted & TAINT_USER ? 'U' : ' ',
+                       tainted & TAINT_DIE ? 'D' : ' ');
        }
        else
                snprintf(buf, sizeof(buf), "Not tainted");
@@ -173,6 +176,7 @@ const char *print_tainted(void)
 
 void add_taint(unsigned flag)
 {
+       debug_locks = 0; /* can't trust the integrity of the kernel anymore */
        tainted |= flag;
 }
 EXPORT_SYMBOL(add_taint);
@@ -257,6 +261,7 @@ int oops_may_print(void)
  */
 void oops_enter(void)
 {
+       debug_locks_off(); /* can't trust the integrity of the kernel anymore */
        do_oops_enter_exit();
 }
 
@@ -268,3 +273,15 @@ void oops_exit(void)
 {
        do_oops_enter_exit();
 }
+
+#ifdef CONFIG_CC_STACKPROTECTOR
+/*
+ * Called when gcc's -fstack-protector feature is used, and
+ * gcc detects corruption of the on-stack canary value
+ */
+void __stack_chk_fail(void)
+{
+       panic("stack-protector: Kernel stack is corrupted");
+}
+EXPORT_SYMBOL(__stack_chk_fail);
+#endif