KVM: x86: Don't re-execute instruction when not passing CR2 value
authorLiran Alon <liran.alon@oracle.com>
Sun, 5 Nov 2017 14:56:34 +0000 (16:56 +0200)
committerBen Hutchings <ben@decadent.org.uk>
Sat, 3 Mar 2018 15:50:37 +0000 (15:50 +0000)
commitadfdc9c7bf265516a8e61be1d1087bc1f36e3096
treeea3fc21baba91ccc8e3f21676eb3a2cfefb0a1fe
parentd6b82aedc5d1af3a870565d9ce1da585e3c59f82
KVM: x86: Don't re-execute instruction when not passing CR2 value

commit 9b8ae63798cb97e785a667ff27e43fa6220cb734 upstream.

In case of instruction-decode failure or emulation failure,
x86_emulate_instruction() will call reexecute_instruction() which will
attempt to use the cr2 value passed to x86_emulate_instruction().
However, when x86_emulate_instruction() is called from
emulate_instruction(), cr2 is not passed (passed as 0) and therefore
it doesn't make sense to execute reexecute_instruction() logic at all.

Fixes: 51d8b66199e9 ("KVM: cleanup emulate_instruction")

Signed-off-by: Liran Alon <liran.alon@oracle.com>
Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: Wanpeng Li <wanpeng.li@hotmail.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/vmx.c