KVM: x86: emulate #UD while in guest mode
authorPaolo Bonzini <pbonzini@redhat.com>
Thu, 11 Jan 2018 15:55:24 +0000 (16:55 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 3 Feb 2018 16:39:18 +0000 (17:39 +0100)
commitc065b9947b05d63936dad5f3d5aa6e83d1e0346f
tree39dcc46a691f474698794c35bf7570855d6acfa1
parente9273b08d4fb808baeebcd2637b5257d3f0db18c
KVM: x86: emulate #UD while in guest mode

[ Upstream commit bd89525a823ce6edddcedbe9aed79faa1b9cf544 ]

This reverts commits ae1f57670703656cc9f293722c3b8b6782f8ab3f
and ac9b305caa0df6f5b75d294e4b86c1027648991e.

If the hardware doesn't support MOVBE, but L0 sets CPUID.01H:ECX.MOVBE
in L1's emulated CPUID information, then L1 is likely to pass that
CPUID bit through to L2. L2 will expect MOVBE to work, but if L1
doesn't intercept #UD, then any MOVBE instruction executed in L2 will
raise #UD, and the exception will be delivered in L2.

Commit ac9b305caa0df6f5b75d294e4b86c1027648991e is a better and more
complete version of ae1f57670703 ("KVM: nVMX: Do not emulate #UD while
in guest mode"); however, neither considers the above case.

Suggested-by: Jim Mattson <jmattson@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kvm/svm.c
arch/x86/kvm/vmx.c