panic.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676
  1. /*
  2. * linux/kernel/panic.c
  3. *
  4. * Copyright (C) 1991, 1992 Linus Torvalds
  5. */
  6. /*
  7. * This function is used through-out the kernel (including mm and fs)
  8. * to indicate a major problem.
  9. */
  10. #include <linux/debug_locks.h>
  11. #include <linux/sched/debug.h>
  12. #include <linux/interrupt.h>
  13. #include <linux/kmsg_dump.h>
  14. #include <linux/kallsyms.h>
  15. #include <linux/notifier.h>
  16. #include <linux/module.h>
  17. #include <linux/random.h>
  18. #include <linux/ftrace.h>
  19. #include <linux/reboot.h>
  20. #include <linux/delay.h>
  21. #include <linux/kexec.h>
  22. #include <linux/sched.h>
  23. #include <linux/sysrq.h>
  24. #include <linux/init.h>
  25. #include <linux/nmi.h>
  26. #include <linux/console.h>
  27. #include <linux/bug.h>
  28. #include <linux/ratelimit.h>
  29. #include <linux/debugfs.h>
  30. #include <asm/sections.h>
  31. #define PANIC_TIMER_STEP 100
  32. #define PANIC_BLINK_SPD 18
  33. int panic_on_oops = CONFIG_PANIC_ON_OOPS_VALUE;
  34. static unsigned long tainted_mask;
  35. static int pause_on_oops;
  36. static int pause_on_oops_flag;
  37. static DEFINE_SPINLOCK(pause_on_oops_lock);
  38. bool crash_kexec_post_notifiers;
  39. int panic_on_warn __read_mostly;
  40. int panic_timeout = CONFIG_PANIC_TIMEOUT;
  41. EXPORT_SYMBOL_GPL(panic_timeout);
  42. ATOMIC_NOTIFIER_HEAD(panic_notifier_list);
  43. EXPORT_SYMBOL(panic_notifier_list);
  44. static long no_blink(int state)
  45. {
  46. return 0;
  47. }
  48. /* Returns how long it waited in ms */
  49. long (*panic_blink)(int state);
  50. EXPORT_SYMBOL(panic_blink);
  51. /*
  52. * Stop ourself in panic -- architecture code may override this
  53. */
  54. void __weak panic_smp_self_stop(void)
  55. {
  56. while (1)
  57. cpu_relax();
  58. }
  59. /*
  60. * Stop ourselves in NMI context if another CPU has already panicked. Arch code
  61. * may override this to prepare for crash dumping, e.g. save regs info.
  62. */
  63. void __weak nmi_panic_self_stop(struct pt_regs *regs)
  64. {
  65. panic_smp_self_stop();
  66. }
  67. /*
  68. * Stop other CPUs in panic. Architecture dependent code may override this
  69. * with more suitable version. For example, if the architecture supports
  70. * crash dump, it should save registers of each stopped CPU and disable
  71. * per-CPU features such as virtualization extensions.
  72. */
  73. void __weak crash_smp_send_stop(void)
  74. {
  75. static int cpus_stopped;
  76. /*
  77. * This function can be called twice in panic path, but obviously
  78. * we execute this only once.
  79. */
  80. if (cpus_stopped)
  81. return;
  82. /*
  83. * Note smp_send_stop is the usual smp shutdown function, which
  84. * unfortunately means it may not be hardened to work in a panic
  85. * situation.
  86. */
  87. smp_send_stop();
  88. cpus_stopped = 1;
  89. }
  90. atomic_t panic_cpu = ATOMIC_INIT(PANIC_CPU_INVALID);
  91. /*
  92. * A variant of panic() called from NMI context. We return if we've already
  93. * panicked on this CPU. If another CPU already panicked, loop in
  94. * nmi_panic_self_stop() which can provide architecture dependent code such
  95. * as saving register state for crash dump.
  96. */
  97. void nmi_panic(struct pt_regs *regs, const char *msg)
  98. {
  99. int old_cpu, cpu;
  100. cpu = raw_smp_processor_id();
  101. old_cpu = atomic_cmpxchg(&panic_cpu, PANIC_CPU_INVALID, cpu);
  102. if (old_cpu == PANIC_CPU_INVALID)
  103. panic("%s", msg);
  104. else if (old_cpu != cpu)
  105. nmi_panic_self_stop(regs);
  106. }
  107. EXPORT_SYMBOL(nmi_panic);
  108. /**
  109. * panic - halt the system
  110. * @fmt: The text string to print
  111. *
  112. * Display a message, then perform cleanups.
  113. *
  114. * This function never returns.
  115. */
  116. void panic(const char *fmt, ...)
  117. {
  118. static char buf[1024];
  119. va_list args;
  120. long i, i_next = 0;
  121. int state = 0;
  122. int old_cpu, this_cpu;
  123. bool _crash_kexec_post_notifiers = crash_kexec_post_notifiers;
  124. /*
  125. * Disable local interrupts. This will prevent panic_smp_self_stop
  126. * from deadlocking the first cpu that invokes the panic, since
  127. * there is nothing to prevent an interrupt handler (that runs
  128. * after setting panic_cpu) from invoking panic() again.
  129. */
  130. local_irq_disable();
  131. /*
  132. * It's possible to come here directly from a panic-assertion and
  133. * not have preempt disabled. Some functions called from here want
  134. * preempt to be disabled. No point enabling it later though...
  135. *
  136. * Only one CPU is allowed to execute the panic code from here. For
  137. * multiple parallel invocations of panic, all other CPUs either
  138. * stop themself or will wait until they are stopped by the 1st CPU
  139. * with smp_send_stop().
  140. *
  141. * `old_cpu == PANIC_CPU_INVALID' means this is the 1st CPU which
  142. * comes here, so go ahead.
  143. * `old_cpu == this_cpu' means we came from nmi_panic() which sets
  144. * panic_cpu to this CPU. In this case, this is also the 1st CPU.
  145. */
  146. this_cpu = raw_smp_processor_id();
  147. old_cpu = atomic_cmpxchg(&panic_cpu, PANIC_CPU_INVALID, this_cpu);
  148. if (old_cpu != PANIC_CPU_INVALID && old_cpu != this_cpu)
  149. panic_smp_self_stop();
  150. console_verbose();
  151. bust_spinlocks(1);
  152. va_start(args, fmt);
  153. vsnprintf(buf, sizeof(buf), fmt, args);
  154. va_end(args);
  155. pr_emerg("Kernel panic - not syncing: %s\n", buf);
  156. #ifdef CONFIG_DEBUG_BUGVERBOSE
  157. /*
  158. * Avoid nested stack-dumping if a panic occurs during oops processing
  159. */
  160. if (!test_taint(TAINT_DIE) && oops_in_progress <= 1)
  161. dump_stack();
  162. #endif
  163. /*
  164. * If we have crashed and we have a crash kernel loaded let it handle
  165. * everything else.
  166. * If we want to run this after calling panic_notifiers, pass
  167. * the "crash_kexec_post_notifiers" option to the kernel.
  168. *
  169. * Bypass the panic_cpu check and call __crash_kexec directly.
  170. */
  171. if (!_crash_kexec_post_notifiers) {
  172. printk_safe_flush_on_panic();
  173. __crash_kexec(NULL);
  174. /*
  175. * Note smp_send_stop is the usual smp shutdown function, which
  176. * unfortunately means it may not be hardened to work in a
  177. * panic situation.
  178. */
  179. smp_send_stop();
  180. } else {
  181. /*
  182. * If we want to do crash dump after notifier calls and
  183. * kmsg_dump, we will need architecture dependent extra
  184. * works in addition to stopping other CPUs.
  185. */
  186. crash_smp_send_stop();
  187. }
  188. /*
  189. * Run any panic handlers, including those that might need to
  190. * add information to the kmsg dump output.
  191. */
  192. atomic_notifier_call_chain(&panic_notifier_list, 0, buf);
  193. /* Call flush even twice. It tries harder with a single online CPU */
  194. printk_safe_flush_on_panic();
  195. kmsg_dump(KMSG_DUMP_PANIC);
  196. /*
  197. * If you doubt kdump always works fine in any situation,
  198. * "crash_kexec_post_notifiers" offers you a chance to run
  199. * panic_notifiers and dumping kmsg before kdump.
  200. * Note: since some panic_notifiers can make crashed kernel
  201. * more unstable, it can increase risks of the kdump failure too.
  202. *
  203. * Bypass the panic_cpu check and call __crash_kexec directly.
  204. */
  205. if (_crash_kexec_post_notifiers)
  206. __crash_kexec(NULL);
  207. bust_spinlocks(0);
  208. /*
  209. * We may have ended up stopping the CPU holding the lock (in
  210. * smp_send_stop()) while still having some valuable data in the console
  211. * buffer. Try to acquire the lock then release it regardless of the
  212. * result. The release will also print the buffers out. Locks debug
  213. * should be disabled to avoid reporting bad unlock balance when
  214. * panic() is not being callled from OOPS.
  215. */
  216. debug_locks_off();
  217. console_flush_on_panic();
  218. if (!panic_blink)
  219. panic_blink = no_blink;
  220. if (panic_timeout > 0) {
  221. /*
  222. * Delay timeout seconds before rebooting the machine.
  223. * We can't use the "normal" timers since we just panicked.
  224. */
  225. pr_emerg("Rebooting in %d seconds..\n", panic_timeout);
  226. for (i = 0; i < panic_timeout * 1000; i += PANIC_TIMER_STEP) {
  227. touch_nmi_watchdog();
  228. if (i >= i_next) {
  229. i += panic_blink(state ^= 1);
  230. i_next = i + 3600 / PANIC_BLINK_SPD;
  231. }
  232. mdelay(PANIC_TIMER_STEP);
  233. }
  234. }
  235. if (panic_timeout != 0) {
  236. /*
  237. * This will not be a clean reboot, with everything
  238. * shutting down. But if there is a chance of
  239. * rebooting the system it will be rebooted.
  240. */
  241. emergency_restart();
  242. }
  243. #ifdef __sparc__
  244. {
  245. extern int stop_a_enabled;
  246. /* Make sure the user can actually press Stop-A (L1-A) */
  247. stop_a_enabled = 1;
  248. pr_emerg("Press Stop-A (L1-A) from sun keyboard or send break\n"
  249. "twice on console to return to the boot prom\n");
  250. }
  251. #endif
  252. #if defined(CONFIG_S390)
  253. {
  254. unsigned long caller;
  255. caller = (unsigned long)__builtin_return_address(0);
  256. disabled_wait(caller);
  257. }
  258. #endif
  259. pr_emerg("---[ end Kernel panic - not syncing: %s ]---\n", buf);
  260. local_irq_enable();
  261. for (i = 0; ; i += PANIC_TIMER_STEP) {
  262. touch_softlockup_watchdog();
  263. if (i >= i_next) {
  264. i += panic_blink(state ^= 1);
  265. i_next = i + 3600 / PANIC_BLINK_SPD;
  266. }
  267. mdelay(PANIC_TIMER_STEP);
  268. }
  269. }
  270. EXPORT_SYMBOL(panic);
  271. /*
  272. * TAINT_FORCED_RMMOD could be a per-module flag but the module
  273. * is being removed anyway.
  274. */
  275. const struct taint_flag taint_flags[TAINT_FLAGS_COUNT] = {
  276. { 'P', 'G', true }, /* TAINT_PROPRIETARY_MODULE */
  277. { 'F', ' ', true }, /* TAINT_FORCED_MODULE */
  278. { 'S', ' ', false }, /* TAINT_CPU_OUT_OF_SPEC */
  279. { 'R', ' ', false }, /* TAINT_FORCED_RMMOD */
  280. { 'M', ' ', false }, /* TAINT_MACHINE_CHECK */
  281. { 'B', ' ', false }, /* TAINT_BAD_PAGE */
  282. { 'U', ' ', false }, /* TAINT_USER */
  283. { 'D', ' ', false }, /* TAINT_DIE */
  284. { 'A', ' ', false }, /* TAINT_OVERRIDDEN_ACPI_TABLE */
  285. { 'W', ' ', false }, /* TAINT_WARN */
  286. { 'C', ' ', true }, /* TAINT_CRAP */
  287. { 'I', ' ', false }, /* TAINT_FIRMWARE_WORKAROUND */
  288. { 'O', ' ', true }, /* TAINT_OOT_MODULE */
  289. { 'E', ' ', true }, /* TAINT_UNSIGNED_MODULE */
  290. { 'L', ' ', false }, /* TAINT_SOFTLOCKUP */
  291. { 'K', ' ', true }, /* TAINT_LIVEPATCH */
  292. { 'X', ' ', true }, /* TAINT_AUX */
  293. };
  294. /**
  295. * print_tainted - return a string to represent the kernel taint state.
  296. *
  297. * 'P' - Proprietary module has been loaded.
  298. * 'F' - Module has been forcibly loaded.
  299. * 'S' - SMP with CPUs not designed for SMP.
  300. * 'R' - User forced a module unload.
  301. * 'M' - System experienced a machine check exception.
  302. * 'B' - System has hit bad_page.
  303. * 'U' - Userspace-defined naughtiness.
  304. * 'D' - Kernel has oopsed before
  305. * 'A' - ACPI table overridden.
  306. * 'W' - Taint on warning.
  307. * 'C' - modules from drivers/staging are loaded.
  308. * 'I' - Working around severe firmware bug.
  309. * 'O' - Out-of-tree module has been loaded.
  310. * 'E' - Unsigned module has been loaded.
  311. * 'L' - A soft lockup has previously occurred.
  312. * 'K' - Kernel has been live patched.
  313. * 'X' - Auxiliary taint, for distros' use.
  314. *
  315. * The string is overwritten by the next call to print_tainted().
  316. */
  317. const char *print_tainted(void)
  318. {
  319. static char buf[TAINT_FLAGS_COUNT + sizeof("Tainted: ")];
  320. if (tainted_mask) {
  321. char *s;
  322. int i;
  323. s = buf + sprintf(buf, "Tainted: ");
  324. for (i = 0; i < TAINT_FLAGS_COUNT; i++) {
  325. const struct taint_flag *t = &taint_flags[i];
  326. *s++ = test_bit(i, &tainted_mask) ?
  327. t->c_true : t->c_false;
  328. }
  329. *s = 0;
  330. } else
  331. snprintf(buf, sizeof(buf), "Not tainted");
  332. return buf;
  333. }
  334. int test_taint(unsigned flag)
  335. {
  336. return test_bit(flag, &tainted_mask);
  337. }
  338. EXPORT_SYMBOL(test_taint);
  339. unsigned long get_taint(void)
  340. {
  341. return tainted_mask;
  342. }
  343. /**
  344. * add_taint: add a taint flag if not already set.
  345. * @flag: one of the TAINT_* constants.
  346. * @lockdep_ok: whether lock debugging is still OK.
  347. *
  348. * If something bad has gone wrong, you'll want @lockdebug_ok = false, but for
  349. * some notewortht-but-not-corrupting cases, it can be set to true.
  350. */
  351. void add_taint(unsigned flag, enum lockdep_ok lockdep_ok)
  352. {
  353. if (lockdep_ok == LOCKDEP_NOW_UNRELIABLE && __debug_locks_off())
  354. pr_warn("Disabling lock debugging due to kernel taint\n");
  355. set_bit(flag, &tainted_mask);
  356. }
  357. EXPORT_SYMBOL(add_taint);
  358. static void spin_msec(int msecs)
  359. {
  360. int i;
  361. for (i = 0; i < msecs; i++) {
  362. touch_nmi_watchdog();
  363. mdelay(1);
  364. }
  365. }
  366. /*
  367. * It just happens that oops_enter() and oops_exit() are identically
  368. * implemented...
  369. */
  370. static void do_oops_enter_exit(void)
  371. {
  372. unsigned long flags;
  373. static int spin_counter;
  374. if (!pause_on_oops)
  375. return;
  376. spin_lock_irqsave(&pause_on_oops_lock, flags);
  377. if (pause_on_oops_flag == 0) {
  378. /* This CPU may now print the oops message */
  379. pause_on_oops_flag = 1;
  380. } else {
  381. /* We need to stall this CPU */
  382. if (!spin_counter) {
  383. /* This CPU gets to do the counting */
  384. spin_counter = pause_on_oops;
  385. do {
  386. spin_unlock(&pause_on_oops_lock);
  387. spin_msec(MSEC_PER_SEC);
  388. spin_lock(&pause_on_oops_lock);
  389. } while (--spin_counter);
  390. pause_on_oops_flag = 0;
  391. } else {
  392. /* This CPU waits for a different one */
  393. while (spin_counter) {
  394. spin_unlock(&pause_on_oops_lock);
  395. spin_msec(1);
  396. spin_lock(&pause_on_oops_lock);
  397. }
  398. }
  399. }
  400. spin_unlock_irqrestore(&pause_on_oops_lock, flags);
  401. }
  402. /*
  403. * Return true if the calling CPU is allowed to print oops-related info.
  404. * This is a bit racy..
  405. */
  406. int oops_may_print(void)
  407. {
  408. return pause_on_oops_flag == 0;
  409. }
  410. /*
  411. * Called when the architecture enters its oops handler, before it prints
  412. * anything. If this is the first CPU to oops, and it's oopsing the first
  413. * time then let it proceed.
  414. *
  415. * This is all enabled by the pause_on_oops kernel boot option. We do all
  416. * this to ensure that oopses don't scroll off the screen. It has the
  417. * side-effect of preventing later-oopsing CPUs from mucking up the display,
  418. * too.
  419. *
  420. * It turns out that the CPU which is allowed to print ends up pausing for
  421. * the right duration, whereas all the other CPUs pause for twice as long:
  422. * once in oops_enter(), once in oops_exit().
  423. */
  424. void oops_enter(void)
  425. {
  426. tracing_off();
  427. /* can't trust the integrity of the kernel anymore: */
  428. debug_locks_off();
  429. do_oops_enter_exit();
  430. }
  431. /*
  432. * 64-bit random ID for oopses:
  433. */
  434. static u64 oops_id;
  435. static int init_oops_id(void)
  436. {
  437. if (!oops_id)
  438. get_random_bytes(&oops_id, sizeof(oops_id));
  439. else
  440. oops_id++;
  441. return 0;
  442. }
  443. late_initcall(init_oops_id);
  444. void print_oops_end_marker(void)
  445. {
  446. init_oops_id();
  447. pr_warn("---[ end trace %016llx ]---\n", (unsigned long long)oops_id);
  448. }
  449. /*
  450. * Called when the architecture exits its oops handler, after printing
  451. * everything.
  452. */
  453. void oops_exit(void)
  454. {
  455. do_oops_enter_exit();
  456. print_oops_end_marker();
  457. kmsg_dump(KMSG_DUMP_OOPS);
  458. }
  459. struct warn_args {
  460. const char *fmt;
  461. va_list args;
  462. };
  463. void __warn(const char *file, int line, void *caller, unsigned taint,
  464. struct pt_regs *regs, struct warn_args *args)
  465. {
  466. disable_trace_on_warning();
  467. if (args)
  468. pr_warn(CUT_HERE);
  469. if (file)
  470. pr_warn("WARNING: CPU: %d PID: %d at %s:%d %pS\n",
  471. raw_smp_processor_id(), current->pid, file, line,
  472. caller);
  473. else
  474. pr_warn("WARNING: CPU: %d PID: %d at %pS\n",
  475. raw_smp_processor_id(), current->pid, caller);
  476. if (args)
  477. vprintk(args->fmt, args->args);
  478. if (panic_on_warn) {
  479. /*
  480. * This thread may hit another WARN() in the panic path.
  481. * Resetting this prevents additional WARN() from panicking the
  482. * system on this thread. Other threads are blocked by the
  483. * panic_mutex in panic().
  484. */
  485. panic_on_warn = 0;
  486. panic("panic_on_warn set ...\n");
  487. }
  488. print_modules();
  489. if (regs)
  490. show_regs(regs);
  491. else
  492. dump_stack();
  493. print_irqtrace_events(current);
  494. print_oops_end_marker();
  495. /* Just a warning, don't kill lockdep. */
  496. add_taint(taint, LOCKDEP_STILL_OK);
  497. }
  498. #ifdef WANT_WARN_ON_SLOWPATH
  499. void warn_slowpath_fmt(const char *file, int line, const char *fmt, ...)
  500. {
  501. struct warn_args args;
  502. args.fmt = fmt;
  503. va_start(args.args, fmt);
  504. __warn(file, line, __builtin_return_address(0), TAINT_WARN, NULL,
  505. &args);
  506. va_end(args.args);
  507. }
  508. EXPORT_SYMBOL(warn_slowpath_fmt);
  509. void warn_slowpath_fmt_taint(const char *file, int line,
  510. unsigned taint, const char *fmt, ...)
  511. {
  512. struct warn_args args;
  513. args.fmt = fmt;
  514. va_start(args.args, fmt);
  515. __warn(file, line, __builtin_return_address(0), taint, NULL, &args);
  516. va_end(args.args);
  517. }
  518. EXPORT_SYMBOL(warn_slowpath_fmt_taint);
  519. void warn_slowpath_null(const char *file, int line)
  520. {
  521. pr_warn(CUT_HERE);
  522. __warn(file, line, __builtin_return_address(0), TAINT_WARN, NULL, NULL);
  523. }
  524. EXPORT_SYMBOL(warn_slowpath_null);
  525. #else
  526. void __warn_printk(const char *fmt, ...)
  527. {
  528. va_list args;
  529. pr_warn(CUT_HERE);
  530. va_start(args, fmt);
  531. vprintk(fmt, args);
  532. va_end(args);
  533. }
  534. EXPORT_SYMBOL(__warn_printk);
  535. #endif
  536. #ifdef CONFIG_BUG
  537. /* Support resetting WARN*_ONCE state */
  538. static int clear_warn_once_set(void *data, u64 val)
  539. {
  540. generic_bug_clear_once();
  541. memset(__start_once, 0, __end_once - __start_once);
  542. return 0;
  543. }
  544. DEFINE_SIMPLE_ATTRIBUTE(clear_warn_once_fops,
  545. NULL,
  546. clear_warn_once_set,
  547. "%lld\n");
  548. static __init int register_warn_debugfs(void)
  549. {
  550. /* Don't care about failure */
  551. debugfs_create_file("clear_warn_once", 0200, NULL,
  552. NULL, &clear_warn_once_fops);
  553. return 0;
  554. }
  555. device_initcall(register_warn_debugfs);
  556. #endif
  557. #ifdef CONFIG_CC_STACKPROTECTOR
  558. /*
  559. * Called when gcc's -fstack-protector feature is used, and
  560. * gcc detects corruption of the on-stack canary value
  561. */
  562. __visible void __stack_chk_fail(void)
  563. {
  564. panic("stack-protector: Kernel stack is corrupted in: %pB\n",
  565. __builtin_return_address(0));
  566. }
  567. EXPORT_SYMBOL(__stack_chk_fail);
  568. #endif
  569. #ifdef CONFIG_ARCH_HAS_REFCOUNT
  570. void refcount_error_report(struct pt_regs *regs, const char *err)
  571. {
  572. WARN_RATELIMIT(1, "refcount_t %s at %pB in %s[%d], uid/euid: %u/%u\n",
  573. err, (void *)instruction_pointer(regs),
  574. current->comm, task_pid_nr(current),
  575. from_kuid_munged(&init_user_ns, current_uid()),
  576. from_kuid_munged(&init_user_ns, current_euid()));
  577. }
  578. #endif
  579. core_param(panic, panic_timeout, int, 0644);
  580. core_param(pause_on_oops, pause_on_oops, int, 0644);
  581. core_param(panic_on_warn, panic_on_warn, int, 0644);
  582. core_param(crash_kexec_post_notifiers, crash_kexec_post_notifiers, bool, 0644);
  583. static int __init oops_setup(char *s)
  584. {
  585. if (!s)
  586. return -EINVAL;
  587. if (!strcmp(s, "panic"))
  588. panic_on_oops = 1;
  589. return 0;
  590. }
  591. early_param("oops", oops_setup);