linux/arch/powerpc
Paul Mackerras 81bba9ff4d KVM: PPC: Book3S HV: Save/restore TM state in H_CEDE
commit 93d17397e4 upstream.

It turns out that if the guest does a H_CEDE while the CPU is in
a transactional state, and the H_CEDE does a nap, and the nap
loses the architected state of the CPU (which is is allowed to do),
then we lose the checkpointed state of the virtual CPU.  In addition,
the transactional-memory state recorded in the MSR gets reset back
to non-transactional, and when we try to return to the guest, we take
a TM bad thing type of program interrupt because we are trying to
transition from non-transactional to transactional with a hrfid
instruction, which is not permitted.

The result of the program interrupt occurring at that point is that
the host CPU will hang in an infinite loop with interrupts disabled.
Thus this is a denial of service vulnerability in the host which can
be triggered by any guest (and depending on the guest kernel, it can
potentially triggered by unprivileged userspace in the guest).

This vulnerability has been assigned the ID CVE-2016-5412.

To fix this, we save the TM state before napping and restore it
on exit from the nap, when handling a H_CEDE in real mode.  The
case where H_CEDE exits to host virtual mode is already OK (as are
other hcalls which exit to host virtual mode) because the exit
path saves the TM state.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
History 2016-08-22 22:38:28 +01:00
..
boot powerpc/boot: Specify ABI v2 when building an LE boot wrapper 2015-10-06 11:52:28 +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: Use privileged SPR number for MMCR2 2016-08-22 22:38:07 +01:00
kernel powerpc/tm: Avoid SLB faults in treclaim/trecheckpoint when RI=0 2016-08-22 22:38:23 +01:00
kvm KVM: PPC: Book3S HV: Save/restore TM state in H_CEDE 2016-08-22 22:38:28 +01:00
lib powerpc: Add smp_mb()s to arch_spin_unlock_wait() 2014-10-05 13:41:08 -07:00
math-emu powerpc: Correct emulated mtfsf instruction 2014-04-07 10:33:11 +10:00
mm powerpc/mm/hash64: Fix subpage protection with 4K HPTE config 2016-08-22 22:37:57 +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/pseries: Fix PCI config address for DDW 2016-08-22 22:38:08 +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