| 1 |
|
| 2 | #ifndef _LINUX_PANIC_H
|
| 3 | #define _LINUX_PANIC_H
|
| 4 |
|
| 5 | #include <linux/compiler_attributes.h>
|
| 6 | #include <linux/stdarg.h>
|
| 7 | #include <linux/types.h>
|
| 8 |
|
| 9 | struct pt_regs;
|
| 10 |
|
| 11 | extern long (*panic_blink)(int state);
|
| 12 | __printf(1, 2)
|
| 13 | void panic(const char *fmt, ...) __noreturn __cold;
|
| 14 | __printf(1, 0)
|
| 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);
|
| 21 |
|
| 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;
|
| 27 |
|
| 28 | extern unsigned long panic_on_taint;
|
| 29 | extern bool panic_on_taint_nousertaint;
|
| 30 |
|
| 31 | extern int sysctl_panic_on_stackoverflow;
|
| 32 |
|
| 33 | extern bool crash_kexec_post_notifiers;
|
| 34 |
|
| 35 | extern void __stack_chk_fail(void);
|
| 36 | void abort(void);
|
| 37 |
|
| 38 | |
| 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().
|
| 42 |
|
| 43 | extern atomic_t panic_cpu;
|
| 44 |
|
| 45 | |
| 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.
|
| 50 |
|
| 51 | extern atomic_t panic_redirect_cpu;
|
| 52 | #define PANIC_CPU_INVALID -1
|
| 53 |
|
| 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);
|
| 59 |
|
| 60 | |
| 61 | * Only to be used by arch init code. If the user over-wrote the default
|
| 62 | * CONFIG_PANIC_TIMEOUT, honor it.
|
| 63 |
|
| 64 | static inline void set_arch_panic_timeout(int timeout, int arch_default_timeout)
|
| 65 | {
|
| 66 | if (panic_timeout == arch_default_timeout)
|
| 67 | panic_timeout = timeout;
|
| 68 | }
|
| 69 |
|
| 70 |
|
| 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
|
| 77 | #define TAINT_USER 6
|
| 78 | #define TAINT_DIE 7
|
| 79 | #define TAINT_OVERRIDDEN_ACPI_TABLE 8
|
| 80 | #define TAINT_WARN 9
|
| 81 | #define TAINT_CRAP 10
|
| 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
|
| 87 | #define TAINT_AUX 16
|
| 88 | #define TAINT_RANDSTRUCT 17
|
| 89 | #define TAINT_TEST 18
|
| 90 | #define TAINT_FWCTL 19
|
| 91 | #define TAINT_FLAGS_COUNT 20
|
| 92 | #define TAINT_FLAGS_MAX ((1UL << TAINT_FLAGS_COUNT) - 1)
|
| 93 |
|
| 94 | struct taint_flag {
|
| 95 | char c_true;
|
| 96 | char c_false;
|
| 97 | const char *desc;
|
| 98 | };
|
| 99 |
|
| 100 | extern const struct taint_flag taint_flags[TAINT_FLAGS_COUNT];
|
| 101 |
|
| 102 | enum lockdep_ok {
|
| 103 | LOCKDEP_STILL_OK,
|
| 104 | LOCKDEP_NOW_UNRELIABLE,
|
| 105 | };
|
| 106 |
|
| 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);
|
| 112 |
|
| 113 | #endif
|