16 #include <linux/module.h>
17 #include <linux/random.h>
18 #include <linux/reboot.h>
20 #include <linux/kexec.h>
21 #include <linux/sched.h>
27 #define PANIC_TIMER_STEP 100
28 #define PANIC_BLINK_SPD 18
31 static unsigned long tainted_mask;
32 static int pause_on_oops;
33 static int pause_on_oops_flag;
43 static long no_blink(
int state)
72 static char buf[1024];
95 if (!spin_trylock(&panic_lock))
104 #ifdef CONFIG_DEBUG_BUGVERBOSE
167 #if defined(CONFIG_S390)
171 caller = (
unsigned long)__builtin_return_address(0);
172 disabled_wait(caller);
195 static const struct tnt tnts[] = {
240 const struct tnt *
t = &tnts[
i];
253 return test_bit(flag, &tainted_mask);
279 if (__debug_locks_off())
287 static void spin_msec(
int msecs)
291 for (i = 0; i < msecs; i++) {
301 static void do_oops_enter_exit(
void)
304 static int spin_counter;
310 if (pause_on_oops_flag == 0) {
312 pause_on_oops_flag = 1;
317 spin_counter = pause_on_oops;
319 spin_unlock(&pause_on_oops_lock);
321 spin_lock(&pause_on_oops_lock);
322 }
while (--spin_counter);
323 pause_on_oops_flag = 0;
326 while (spin_counter) {
327 spin_unlock(&pause_on_oops_lock);
329 spin_lock(&pause_on_oops_lock);
333 spin_unlock_irqrestore(&pause_on_oops_lock, flags);
342 return pause_on_oops_flag == 0;
364 do_oops_enter_exit();
372 static int init_oops_id(
void)
387 (
unsigned long long)oops_id);
396 do_oops_enter_exit();
401 #ifdef WANT_WARN_ON_SLOWPATH
402 struct slowpath_args {
407 static void warn_slowpath_common(
const char *
file,
int line,
void *
caller,
408 unsigned taint,
struct slowpath_args *args)
419 vprintk(args->fmt, args->args);
427 void warn_slowpath_fmt(
const char *file,
int line,
const char *
fmt, ...)
429 struct slowpath_args args;
433 warn_slowpath_common(file, line, __builtin_return_address(0),
439 void warn_slowpath_fmt_taint(
const char *file,
int line,
440 unsigned taint,
const char *fmt, ...)
442 struct slowpath_args args;
446 warn_slowpath_common(file, line, __builtin_return_address(0),
452 void warn_slowpath_null(
const char *file,
int line)
454 warn_slowpath_common(file, line, __builtin_return_address(0),
460 #ifdef CONFIG_CC_STACKPROTECTOR
466 void __stack_chk_fail(
void)
468 panic(
"stack-protector: Kernel stack is corrupted in: %p\n",
469 __builtin_return_address(0));
476 core_param(pause_on_oops, pause_on_oops,
int, 0644);
478 static int __init oops_setup(
char *
s)