diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2020-06-08 11:11:38 -0700 | 
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2020-06-08 11:11:38 -0700 | 
| commit | 20b0d06722169e6e66049c8fe6f1a48adffb79c6 (patch) | |
| tree | 1b88278ca547c07f58297325aea1ab3c447e844d /kernel/panic.c | |
| parent | 63d72b93f2262900c8de74ad0f5a58e0d452c9d3 (diff) | |
| parent | db33ec371be8e45956e8cebb5b0fe641f008430b (diff) | |
Merge branch 'akpm' (patches from Andrew)
Merge still more updates from Andrew Morton:
 "Various trees. Mainly those parts of MM whose linux-next dependents
  are now merged. I'm still sitting on ~160 patches which await merges
  from -next.
  Subsystems affected by this patch series: mm/proc, ipc, dynamic-debug,
  panic, lib, sysctl, mm/gup, mm/pagemap"
* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (52 commits)
  doc: cgroup: update note about conditions when oom killer is invoked
  module: move the set_fs hack for flush_icache_range to m68k
  nommu: use flush_icache_user_range in brk and mmap
  binfmt_flat: use flush_icache_user_range
  exec: use flush_icache_user_range in read_code
  exec: only build read_code when needed
  m68k: implement flush_icache_user_range
  arm: rename flush_cache_user_range to flush_icache_user_range
  xtensa: implement flush_icache_user_range
  sh: implement flush_icache_user_range
  asm-generic: add a flush_icache_user_range stub
  mm: rename flush_icache_user_range to flush_icache_user_page
  arm,sparc,unicore32: remove flush_icache_user_range
  riscv: use asm-generic/cacheflush.h
  powerpc: use asm-generic/cacheflush.h
  openrisc: use asm-generic/cacheflush.h
  m68knommu: use asm-generic/cacheflush.h
  microblaze: use asm-generic/cacheflush.h
  ia64: use asm-generic/cacheflush.h
  hexagon: use asm-generic/cacheflush.h
  ...
Diffstat (limited to 'kernel/panic.c')
| -rw-r--r-- | kernel/panic.c | 45 | 
1 files changed, 45 insertions, 0 deletions
diff --git a/kernel/panic.c b/kernel/panic.c index b69ee9e76cb2..85568bbfb12b 100644 --- a/kernel/panic.c +++ b/kernel/panic.c @@ -36,6 +36,14 @@  #define PANIC_TIMER_STEP 100  #define PANIC_BLINK_SPD 18 +#ifdef CONFIG_SMP +/* + * Should we dump all CPUs backtraces in an oops event? + * Defaults to 0, can be changed via sysctl. + */ +unsigned int __read_mostly sysctl_oops_all_cpu_backtrace; +#endif /* CONFIG_SMP */ +  int panic_on_oops = CONFIG_PANIC_ON_OOPS_VALUE;  static unsigned long tainted_mask =  	IS_ENABLED(CONFIG_GCC_PLUGIN_RANDSTRUCT) ? (1 << TAINT_RANDSTRUCT) : 0; @@ -44,6 +52,8 @@ static int pause_on_oops_flag;  static DEFINE_SPINLOCK(pause_on_oops_lock);  bool crash_kexec_post_notifiers;  int panic_on_warn __read_mostly; +unsigned long panic_on_taint; +bool panic_on_taint_nousertaint = false;  int panic_timeout = CONFIG_PANIC_TIMEOUT;  EXPORT_SYMBOL_GPL(panic_timeout); @@ -434,6 +444,11 @@ void add_taint(unsigned flag, enum lockdep_ok lockdep_ok)  		pr_warn("Disabling lock debugging due to kernel taint\n");  	set_bit(flag, &tainted_mask); + +	if (tainted_mask & panic_on_taint) { +		panic_on_taint = 0; +		panic("panic_on_taint set ..."); +	}  }  EXPORT_SYMBOL(add_taint); @@ -515,6 +530,9 @@ void oops_enter(void)  	/* can't trust the integrity of the kernel anymore: */  	debug_locks_off();  	do_oops_enter_exit(); + +	if (sysctl_oops_all_cpu_backtrace) +		trigger_all_cpu_backtrace();  }  /* @@ -686,3 +704,30 @@ static int __init oops_setup(char *s)  	return 0;  }  early_param("oops", oops_setup); + +static int __init panic_on_taint_setup(char *s) +{ +	char *taint_str; + +	if (!s) +		return -EINVAL; + +	taint_str = strsep(&s, ","); +	if (kstrtoul(taint_str, 16, &panic_on_taint)) +		return -EINVAL; + +	/* make sure panic_on_taint doesn't hold out-of-range TAINT flags */ +	panic_on_taint &= TAINT_FLAGS_MAX; + +	if (!panic_on_taint) +		return -EINVAL; + +	if (s && !strcmp(s, "nousertaint")) +		panic_on_taint_nousertaint = true; + +	pr_info("panic_on_taint: bitmask=0x%lx nousertaint_mode=%sabled\n", +		panic_on_taint, panic_on_taint_nousertaint ? "en" : "dis"); + +	return 0; +} +early_param("panic_on_taint", panic_on_taint_setup);  | 
