linux/arch/powerpc
Nicholas Piggin cb2f131f8d powerpc/64: Initialise thread_info for emergency stacks
commit 34f19ff1b5 upstream.

Emergency stacks have their thread_info mostly uninitialised, which in
particular means garbage preempt_count values.

Emergency stack code runs with interrupts disabled entirely, and is
used very rarely, so this has been unnoticed so far. It was found by a
proposed new powerpc watchdog that takes a soft-NMI directly from the
masked_interrupt handler and using the emergency stack. That crashed
at BUG_ON(in_nmi()) in nmi_enter(). preempt_count()s were found to be
garbage.

To fix this, zero the entire THREAD_SIZE allocation, and initialize
the thread_info.

Reported-by: Abdul Haleem <abdhalee@linux.vnet.ibm.com>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
[mpe: Move it all into setup_64.c, use a function not a macro. Fix
      crashes on Cell by setting preempt_count to 0 not HARDIRQ_OFFSET]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
[bwh: Backported to 3.16:
 - There are only two emergency stacks
 - No need to call klp_init_thread_info()
 - Add the ti variable in emergency_stack_init()]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
History 2017-09-15 18:30:15 +01:00
..
boot powerpc/boot: Fix zImage TOC alignment 2017-07-18 18:40:08 +01:00
configs powerpc: Remove platforms/wsp and associated pieces 2014-06-11 16:35:38 +10:00
crypto crypto: add missing crypto module aliases 2015-02-04 10:57:50 +00:00
include powerpc/numa: Fix percpu allocations to be NUMA aware 2017-09-15 18:29:57 +01:00
kernel powerpc/64: Initialise thread_info for emergency stacks 2017-09-15 18:30:15 +01:00
kvm KVM: PPC: Book3S HV: Preserve userspace HTM state properly 2017-09-15 18:30:11 +01:00
lib powerpc/64: Fix incorrect return value from __copy_tofrom_user 2017-02-23 03:54:11 +00:00
math-emu powerpc: Correct emulated mtfsf instruction 2014-04-07 10:33:11 +10:00
mm mm: larger stack guard gap, between vmas 2017-07-02 17:13:02 +01:00
net net: filter: make JITs zero A for SKF_AD_ALU_XOR_X 2016-01-25 10:44:05 +00:00
oprofile cpufreq: remove unused notifier: CPUFREQ_{SUSPENDCHANGE|RESUMECHANGE} 2014-03-19 14:10:24 +01:00
perf powerpc/perf: Remove PPMU_HAS_SSLOT flag for Power8 2016-02-17 10:22:48 +00:00
platforms powerpc/spufs: Fix coredump of SPU contexts 2017-09-15 18:29:53 +01:00
sysdev powerpc/MSI: Fix race condition in tearing down MSI interrupts 2015-09-30 13:20:55 +01:00
xmon powerpc/xmon: Fix another endiannes issue in RTAS call from xmon 2015-02-04 10:58:05 +00:00
Kconfig powerpc/bpf/jit: Disable classic BPF JIT on ppc64le 2016-08-22 22:38:18 +01:00
Kconfig.debug powerpc/powernv: Remove OPAL v1 takeover 2014-06-25 13:10:47 +10:00
Makefile Merge branch 'merge' into next 2014-05-28 13:30:12 +10:00
relocs_check.pl Fix warning typo "CONFIG_RELCOATABLE" 2013-05-29 15:11:30 +02:00