android_kernel_xiaomi_sm7250/arch/powerpc
Michael Neuling ed596114fd powerpc: Fix undetected data corruption with P9N DD2.1 VSX CI load emulation
commit 1da4a0272c5469169f78cd76cf175ff984f52f06 upstream.

__get_user_atomic_128_aligned() stores to kaddr using stvx which is a
VMX store instruction, hence kaddr must be 16 byte aligned otherwise
the store won't occur as expected.

Unfortunately when we call __get_user_atomic_128_aligned() in
p9_hmi_special_emu(), the buffer we pass as kaddr (ie. vbuf) isn't
guaranteed to be 16B aligned. This means that the write to vbuf in
__get_user_atomic_128_aligned() has the bottom bits of the address
truncated. This results in other local variables being
overwritten. Also vbuf will not contain the correct data which results
in the userspace emulation being wrong and hence undetected user data
corruption.

In the past we've been mostly lucky as vbuf has ended up aligned but
this is fragile and isn't always true. CONFIG_STACKPROTECTOR in
particular can change the stack arrangement enough that our luck runs
out.

This issue only occurs on POWER9 Nimbus <= DD2.1 bare metal.

The fix is to align vbuf to a 16 byte boundary.

Fixes: 5080332c2c ("powerpc/64s: Add workaround for P9 vector CI load issue")
Cc: stable@vger.kernel.org # v4.15+
Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20201013043741.743413-1-mikey@neuling.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-11-05 11:08:51 +01:00
..
boot powerpc/boot: Fix CONFIG_PPC_MPC52XX references 2020-08-19 08:15:00 +02:00
configs vgacon: remove software scrollback support 2020-09-17 13:45:29 +02:00
crypto
include powerpc/drmem: Make lmb_size 64 bit 2020-11-05 11:08:51 +01:00
kernel powerpc: Fix undetected data corruption with P9N DD2.1 VSX CI load emulation 2020-11-05 11:08:51 +01:00
kvm KVM: PPC: Book3S HV: Treat TM-related invalid form instructions on P9 like the valid ones 2020-10-01 13:14:38 +02:00
lib
math-emu
mm powerpc/64s/radix: Fix mm_cpumask trimming race vs kthread_use_mm 2020-10-30 10:38:19 +01:00
net powerpc/bpf: Fix tail call implementation 2019-12-05 09:19:39 +01:00
oprofile
perf powerpc/perf/hv-gpci: Fix starting index value 2020-10-30 10:38:20 +01:00
platforms powerpc/powernv/elog: Fix race while processing OPAL error log event. 2020-11-05 11:08:51 +01:00
purgatory
sysdev powerpc/icp-hv: Fix missing of_node_put() in success path 2020-10-29 09:55:16 +01:00
tools powerpc/tools: Don't quote $objdump in scripts 2020-01-04 19:12:42 +01:00
xmon powerpc: Make setjmp/longjmp signature standard 2020-04-17 10:48:54 +02:00
Kconfig powerpc/rtas: Restrict RTAS requests from userspace 2020-11-05 11:08:51 +01:00
Kconfig.debug
Makefile powerpc: vdso: Make vdso32 installation conditional in vdso_install 2020-01-27 14:50:40 +01:00
Makefile.postlink