]> git.ipfire.org Git - people/arne_f/kernel.git/commit
KVM: PPC: Book3S HV: Prohibit setting illegal transaction state in MSR
authorPaul Mackerras <paulus@ozlabs.org>
Thu, 12 Nov 2015 05:43:02 +0000 (16:43 +1100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 29 Jan 2016 05:57:05 +0000 (21:57 -0800)
commit0d9fcdb192f5c3f8cd0c392b6782d8e288fb441f
tree8e58430e15e3313d3235ce146bb26d96fb8c0032
parentc2f14d8fa63a57003f7eaee4d2a09005da136a55
KVM: PPC: Book3S HV: Prohibit setting illegal transaction state in MSR

commit c20875a3e638e4a03e099b343ec798edd1af5cc6 upstream.

Currently it is possible for userspace (e.g. QEMU) to set a value
for the MSR for a guest VCPU which has both of the TS bits set,
which is an illegal combination.  The result of this is that when
we execute a hrfid (hypervisor return from interrupt doubleword)
instruction to enter the guest, the CPU will take a TM Bad Thing
type of program interrupt (vector 0x700).

Now, if PR KVM is configured in the kernel along with HV KVM, we
actually handle this without crashing the host or giving hypervisor
privilege to the guest; instead what happens is that we deliver a
program interrupt to the guest, with SRR0 reflecting the address
of the hrfid instruction and SRR1 containing the MSR value at that
point.  If PR KVM is not configured in the kernel, then we try to
run the host's program interrupt handler with the MMU set to the
guest context, which almost certainly causes a host crash.

This closes the hole by making kvmppc_set_msr_hv() check for the
illegal combination and force the TS field to a safe value (00,
meaning non-transactional).

Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/kvm/book3s_hv.c