linux/arch/mips/kvm
James Hogan 98119ad533 MIPS: KVM: Handle MSA Disabled exceptions from guest
Guest user mode can generate a guest MSA Disabled exception on an MSA
capable core by simply trying to execute an MSA instruction. Since this
exception is unknown to KVM it will be passed on to the guest kernel.
However guest Linux kernels prior to v3.15 do not set up an exception
handler for the MSA Disabled exception as they don't support any MSA
capable cores. This results in a guest OS panic.

Since an older processor ID may be being emulated, and MSA support is
not advertised to the guest, the correct behaviour is to generate a
Reserved Instruction exception in the guest kernel so it can send the
guest process an illegal instruction signal (SIGILL), as would happen
with a non-MSA-capable core.

Fix this as minimally as reasonably possible by preventing
kvm_mips_check_privilege() from relaying MSA Disabled exceptions from
guest user mode to the guest kernel, and handling the MSA Disabled
exception by emulating a Reserved Instruction exception in the guest,
via a new handle_msa_disabled() KVM callback.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Paul Burton <paul.burton@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Gleb Natapov <gleb@kernel.org>
Cc: linux-mips@linux-mips.org
Cc: kvm@vger.kernel.org
Cc: <stable@vger.kernel.org> # v3.15+
2015-03-27 21:25:05 +00:00
..
00README.txt
callback.c MIPS: KVM: Rename files to remove the prefix "kvm_" and "kvm_mips_" 2014-06-30 16:52:03 +02:00
commpage.c MIPS: KVM: Skip memory cleaning in kvm_mips_commpage_init() 2014-06-30 16:52:03 +02:00
commpage.h MIPS: KVM: Rename files to remove the prefix "kvm_" and "kvm_mips_" 2014-06-30 16:52:03 +02:00
dyntrans.c MIPS: KVM: Rename files to remove the prefix "kvm_" and "kvm_mips_" 2014-06-30 16:52:03 +02:00
emulate.c MIPS: KVM: Handle MSA Disabled exceptions from guest 2015-03-27 21:25:05 +00:00
interrupt.c MIPS: KVM: Rename files to remove the prefix "kvm_" and "kvm_mips_" 2014-06-30 16:52:03 +02:00
interrupt.h MIPS: KVM: Rename files to remove the prefix "kvm_" and "kvm_mips_" 2014-06-30 16:52:03 +02:00
Kconfig rcu: Make SRCU optional by using CONFIG_SRCU 2015-01-06 11:04:29 -08:00
locore.S KVM: MIPS: Don't leak FPU/DSP to guest 2015-02-04 18:32:14 +01:00
Makefile MIPS: KVM: Rename files to remove the prefix "kvm_" and "kvm_mips_" 2014-06-30 16:52:03 +02:00
mips.c MIPS: KVM: Handle MSA Disabled exceptions from guest 2015-03-27 21:25:05 +00:00
opcode.h MIPS: KVM: Rename files to remove the prefix "kvm_" and "kvm_mips_" 2014-06-30 16:52:03 +02:00
stats.c MIPS: KVM: Rename files to remove the prefix "kvm_" and "kvm_mips_" 2014-06-30 16:52:03 +02:00
tlb.c KVM: MIPS: Enable after disabling interrupt 2015-03-02 19:18:12 -03:00
trace.h KVM: MIPS: Fix trace event to save PC directly 2015-03-02 19:17:52 -03:00
trap_emul.c MIPS: KVM: Handle MSA Disabled exceptions from guest 2015-03-27 21:25:05 +00:00