android_kernel_oneplus_msm8998/arch/powerpc
Michael Neuling 5a51c55493 powerpc/tm: Avoid possible userspace r1 corruption on reclaim
[ Upstream commit 96dc89d526ef77604376f06220e3d2931a0bfd58 ]

Current we store the userspace r1 to PACATMSCRATCH before finally
saving it to the thread struct.

In theory an exception could be taken here (like a machine check or
SLB miss) that could write PACATMSCRATCH and hence corrupt the
userspace r1. The SLB fault currently doesn't touch PACATMSCRATCH, but
others do.

We've never actually seen this happen but it's theoretically
possible. Either way, the code is fragile as it is.

This patch saves r1 to the kernel stack (which can't fault) before we
turn MSR[RI] back on. PACATMSCRATCH is still used but only with
MSR[RI] off. We then copy r1 from the kernel stack to the thread
struct once we have MSR[RI] back on.

Suggested-by: Breno Leitao <leitao@debian.org>
Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-20 09:52:38 +02:00
..
boot powerpc/corenet: explicitly disable the SDHC controller on kmcoge4 2017-11-15 17:13:09 +01:00
configs powerpc updates for 4.4 2015-11-05 23:38:43 -08:00
crypto
include powerpc/fadump: handle crash memory ranges array index overflow 2018-09-09 20:04:32 +02:00
kernel powerpc/tm: Avoid possible userspace r1 corruption on reclaim 2018-10-20 09:52:38 +02:00
kvm KVM: PPC: Book3S HV: Don't truncate HPTE index in xlate function 2018-10-10 08:52:10 +02:00
lib powerpc/lib: Fix off-by-one in alternate feature patching 2018-04-24 09:32:11 +02:00
math-emu
mm powerpc/64s: Fix compiler store ordering to SLB shadow area 2018-08-06 16:24:31 +02:00
net powerpc/bpf/jit: Fix 32-bit JIT for seccomp_data access 2018-05-30 07:49:00 +02:00
oprofile powerpc: Remove mtmsrd(), use existing mtmsr() 2015-07-13 15:47:28 +10:00
perf powerpc/perf: Fix kernel address leak via sampling registers 2018-05-30 07:49:10 +02:00
platforms powerpc/powernv/ioda2: Reduce upper limit for DMA window size 2018-10-10 08:52:05 +02:00
sysdev powerpc: Fix size calculation using resource_size() 2018-09-15 09:40:39 +02:00
xmon powerpc/xmon: Add some more elements to the existing PACA dump list 2015-10-15 20:32:02 +11:00
Kconfig powerpc/64s: Wire up cpu_show_meltdown() 2018-02-16 20:09:36 +01:00
Kconfig.debug
Makefile powerpc/cell: Drop CONFIG_TUNE_CELL in favour of CONFIG_CELL_CPU 2015-10-19 19:51:18 +11:00
relocs_check.sh