1 /* SPDX-License-Identifier: GPL-2.0 */
5 #include <linux/compiler_attributes.h>
6 #include <linux/stdarg.h>
7 #include <linux/types.h>
11 extern long (*panic_blink
)(int state
);
13 void panic(const char *fmt
, ...) __noreturn __cold
;
15 void vpanic(const char *fmt
, va_list args
) __noreturn __cold
;
16 void nmi_panic(struct pt_regs
*regs
, const char *msg
);
17 void check_panic_on_warn(const char *origin
);
18 extern void oops_enter(void);
19 extern void oops_exit(void);
20 extern bool oops_may_print(void);
22 extern bool panic_triggering_all_cpu_backtrace
;
23 extern int panic_timeout
;
24 extern unsigned long panic_print
;
25 extern int panic_on_oops
;
26 extern int panic_on_warn
;
28 extern unsigned long panic_on_taint
;
29 extern bool panic_on_taint_nousertaint
;
31 extern int sysctl_panic_on_stackoverflow
;
33 extern bool crash_kexec_post_notifiers
;
35 extern void __stack_chk_fail(void);
39 * panic_cpu is used for synchronizing panic() and crash_kexec() execution. It
40 * holds a CPU number which is executing panic() currently. A value of
41 * PANIC_CPU_INVALID means no CPU has entered panic() or crash_kexec().
43 extern atomic_t panic_cpu
;
46 * panic_redirect_cpu is used when panic is redirected to a specific CPU via
47 * the panic_force_cpu= boot parameter. It holds the CPU number that originally
48 * triggered the panic before redirection. A value of PANIC_CPU_INVALID means
49 * no redirection has occurred.
51 extern atomic_t panic_redirect_cpu
;
52 #define PANIC_CPU_INVALID -1
54 bool panic_try_start(void);
55 void panic_reset(void);
56 bool panic_in_progress(void);
57 bool panic_on_this_cpu(void);
58 bool panic_on_other_cpu(void);
61 * Only to be used by arch init code. If the user over-wrote the default
62 * CONFIG_PANIC_TIMEOUT, honor it.
64 static inline void set_arch_panic_timeout(int timeout
, int arch_default_timeout
)
66 if (panic_timeout
== arch_default_timeout
)
67 panic_timeout
= timeout
;
70 /* This cannot be an enum because some may be used in assembly source. */
71 #define TAINT_PROPRIETARY_MODULE 0
72 #define TAINT_FORCED_MODULE 1
73 #define TAINT_CPU_OUT_OF_SPEC 2
74 #define TAINT_FORCED_RMMOD 3
75 #define TAINT_MACHINE_CHECK 4
76 #define TAINT_BAD_PAGE 5
79 #define TAINT_OVERRIDDEN_ACPI_TABLE 8
82 #define TAINT_FIRMWARE_WORKAROUND 11
83 #define TAINT_OOT_MODULE 12
84 #define TAINT_UNSIGNED_MODULE 13
85 #define TAINT_SOFTLOCKUP 14
86 #define TAINT_LIVEPATCH 15
88 #define TAINT_RANDSTRUCT 17
90 #define TAINT_FWCTL 19
91 #define TAINT_FLAGS_COUNT 20
92 #define TAINT_FLAGS_MAX ((1UL << TAINT_FLAGS_COUNT) - 1)
95 char c_true
; /* character printed when tainted */
96 char c_false
; /* character printed when not tainted */
97 const char *desc
; /* verbose description of the set taint flag */
100 extern const struct taint_flag taint_flags
[TAINT_FLAGS_COUNT
];
104 LOCKDEP_NOW_UNRELIABLE
,
107 extern const char *print_tainted(void);
108 extern const char *print_tainted_verbose(void);
109 extern void add_taint(unsigned flag
, enum lockdep_ok
);
110 extern int test_taint(unsigned flag
);
111 extern unsigned long get_taint(void);
113 #endif /* _LINUX_PANIC_H */