cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

panic.h (2610B)


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