1 /* SPDX-License-Identifier: GPL-2.0 */
5 #include <linux/compiler_attributes.h>
6 #include <linux/types.h>
10 extern long (*panic_blink)(int state);
12 void panic(const char *fmt, ...) __noreturn __cold;
13 void nmi_panic(struct pt_regs *regs, const char *msg);
14 extern void oops_enter(void);
15 extern void oops_exit(void);
16 extern bool oops_may_print(void);
19 extern unsigned int sysctl_oops_all_cpu_backtrace;
21 #define sysctl_oops_all_cpu_backtrace 0
22 #endif /* CONFIG_SMP */
24 extern int panic_timeout;
25 extern unsigned long panic_print;
26 extern int panic_on_oops;
27 extern int panic_on_unrecovered_nmi;
28 extern int panic_on_io_nmi;
29 extern int panic_on_warn;
31 extern unsigned long panic_on_taint;
32 extern bool panic_on_taint_nousertaint;
34 extern int sysctl_panic_on_rcu_stall;
35 extern int sysctl_max_rcu_stall_to_panic;
36 extern int sysctl_panic_on_stackoverflow;
38 extern bool crash_kexec_post_notifiers;
41 * panic_cpu is used for synchronizing panic() and crash_kexec() execution. It
42 * holds a CPU number which is executing panic() currently. A value of
43 * PANIC_CPU_INVALID means no CPU has entered panic() or crash_kexec().
45 extern atomic_t panic_cpu;
46 #define PANIC_CPU_INVALID -1
49 * Only to be used by arch init code. If the user over-wrote the default
50 * CONFIG_PANIC_TIMEOUT, honor it.
52 static inline void set_arch_panic_timeout(int timeout, int arch_default_timeout)
54 if (panic_timeout == arch_default_timeout)
55 panic_timeout = timeout;
58 /* This cannot be an enum because some may be used in assembly source. */
59 #define TAINT_PROPRIETARY_MODULE 0
60 #define TAINT_FORCED_MODULE 1
61 #define TAINT_CPU_OUT_OF_SPEC 2
62 #define TAINT_FORCED_RMMOD 3
63 #define TAINT_MACHINE_CHECK 4
64 #define TAINT_BAD_PAGE 5
67 #define TAINT_OVERRIDDEN_ACPI_TABLE 8
70 #define TAINT_FIRMWARE_WORKAROUND 11
71 #define TAINT_OOT_MODULE 12
72 #define TAINT_UNSIGNED_MODULE 13
73 #define TAINT_SOFTLOCKUP 14
74 #define TAINT_LIVEPATCH 15
76 #define TAINT_RANDSTRUCT 17
77 #define TAINT_FLAGS_COUNT 18
78 #define TAINT_FLAGS_MAX ((1UL << TAINT_FLAGS_COUNT) - 1)
81 char c_true; /* character printed when tainted */
82 char c_false; /* character printed when not tainted */
83 bool module; /* also show as a per-module taint flag */
86 extern const struct taint_flag taint_flags[TAINT_FLAGS_COUNT];
90 LOCKDEP_NOW_UNRELIABLE,
93 extern const char *print_tainted(void);
94 extern void add_taint(unsigned flag, enum lockdep_ok);
95 extern int test_taint(unsigned flag);
96 extern unsigned long get_taint(void);
98 #endif /* _LINUX_PANIC_H */