panic.c 17 KB

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