kvm: nVMX: reflect MTF VM-exits if injected by L1
authorOliver Upton <oupton@google.com>
Tue, 14 Apr 2020 22:47:45 +0000 (22:47 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 15 Apr 2020 16:08:35 +0000 (12:08 -0400)
commitb045ae906b42afb361dc7ecf1a3cea110fb0a65f
tree45334ed7633cd79deece32df67ece2f106487b9b
parent97daa028f3f621adff2c4f7b15fe0874e5b5bd6c
kvm: nVMX: reflect MTF VM-exits if injected by L1

According to SDM 26.6.2, it is possible to inject an MTF VM-exit via the
VM-entry interruption-information field regardless of the 'monitor trap
flag' VM-execution control. KVM appropriately copies the VM-entry
interruption-information field from vmcs12 to vmcs02. However, if L1
has not set the 'monitor trap flag' VM-execution control, KVM fails to
reflect the subsequent MTF VM-exit into L1.

Fix this by consulting the VM-entry interruption-information field of
vmcs12 to determine if L1 has injected the MTF VM-exit. If so, reflect
the exit, regardless of the 'monitor trap flag' VM-execution control.

Fixes: 5f3d45e7f282 ("kvm/x86: add support for MONITOR_TRAP_FLAG")
Signed-off-by: Oliver Upton <oupton@google.com>
Reviewed-by: Peter Shier <pshier@google.com>
Reviewed-by: Jim Mattson <jmattson@google.com>
Message-Id: <20200414224746.240324-1-oupton@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx/nested.c