linux_dsm_epyc7002/arch/powerpc
Paul Mackerras c22435a5f3 powerpc: Emulate FP/vector/VSX loads/stores correctly when regs not live
At present, the analyse_instr/emulate_step code checks for the
relevant MSR_FP/VEC/VSX bit being set when a FP/VMX/VSX load
or store is decoded, but doesn't recheck the bit before reading or
writing the relevant FP/VMX/VSX register in emulate_step().

Since we don't have preemption disabled, it is possible that we get
preempted between checking the MSR bit and doing the register access.
If that happened, then the registers would have been saved to the
thread_struct for the current process.  Accesses to the CPU registers
would then potentially read stale values, or write values that would
never be seen by the user process.

Another way that the registers can become non-live is if a page
fault occurs when accessing user memory, and the page fault code
calls a copy routine that wants to use the VMX or VSX registers.

To fix this, the code for all the FP/VMX/VSX loads gets restructured
so that it forms an image in a local variable of the desired register
contents, then disables preemption, checks the MSR bit and either
sets the CPU register or writes the value to the thread struct.
Similarly, the code for stores checks the MSR bit, copies either the
CPU register or the thread struct to a local variable, then reenables
preemption and then copies the register image to memory.

If the instruction being emulated is in the kernel, then we must not
use the register values in the thread_struct.  In this case, if the
relevant MSR enable bit is not set, then emulate_step refuses to
emulate the instruction.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2017-09-01 16:39:52 +10:00
..
boot powerpc: conditionally compile platform-specific serial drivers 2017-08-31 14:26:48 +10:00
configs powerpc/configs: Enable THP and 64K for ppc64(le)_defconfig 2017-08-31 14:26:47 +10:00
crypto Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2017-05-02 15:53:46 -07:00
include powerpc: Emulate FP/vector/VSX loads/stores correctly when regs not live 2017-09-01 16:39:52 +10:00
kernel powerpc: Fix DAR reporting when alignment handler faults 2017-08-31 22:06:57 +10:00
kvm Merge branch 'topic/ppc-kvm' into next 2017-08-29 21:26:30 +10:00
lib powerpc: Emulate FP/vector/VSX loads/stores correctly when regs not live 2017-09-01 16:39:52 +10:00
math-emu Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
mm powerpc/mm/radix: Prettify mapped memory range print out 2017-08-31 14:26:42 +10:00
net powerpc/bpf: Use memset32() to pre-fill traps in BPF page(s) 2017-08-17 23:04:47 +10:00
oprofile ktime: Cleanup ktime_set() usage 2016-12-25 17:21:22 +01:00
perf Merge branch 'topic/ppc-kvm' into next 2017-08-17 23:14:17 +10:00
platforms powerpc/pseries: Don't attempt to acquire drc during memory hot add for assigned lmbs 2017-08-31 20:02:23 +10:00
purgatory powerpc/asm: Convert .llong directives to .8byte 2017-08-31 14:26:47 +10:00
sysdev powerpc/xive: Fix the size of the cpumask used in xive_find_target_in_mask() 2017-08-24 15:20:18 +10:00
tools powerpc/64: Tool to check head sections location sanity 2017-05-30 14:59:51 +10:00
xmon powerpc/xmon: Add ISA v3.0 SPRs to SPR dump 2017-08-31 14:26:45 +10:00
Kconfig powerpc/mm: Implement STRICT_KERNEL_RWX on PPC32 2017-08-15 22:55:57 +10:00
Kconfig.debug powerpc/xmon: Enable disassembly files (compilation changes) 2017-02-15 20:02:42 +11:00
Makefile Merge branch 'fixes' into next 2017-08-23 22:20:10 +10:00
Makefile.postlink powerpc/64: Tool to check head sections location sanity 2017-05-30 14:59:51 +10:00