提交 fc3a9157 编写于 作者: J Joerg Roedel 提交者: Avi Kivity

KVM: X86: Don't report L2 emulation failures to user-space

This patch prevents that emulation failures which result
from emulating an instruction for an L2-Guest results in
being reported to userspace.
Without this patch a malicious L2-Guest would be able to
kill the L1 by triggering a race-condition between an vmexit
and the instruction emulator.
With this patch the L2 will most likely only kill itself in
this situation.
Signed-off-by: NJoerg Roedel <joerg.roedel@amd.com>
Signed-off-by: NMarcelo Tosatti <mtosatti@redhat.com>
上级 2030753d
...@@ -4314,13 +4314,19 @@ EXPORT_SYMBOL_GPL(kvm_inject_realmode_interrupt); ...@@ -4314,13 +4314,19 @@ EXPORT_SYMBOL_GPL(kvm_inject_realmode_interrupt);
static int handle_emulation_failure(struct kvm_vcpu *vcpu) static int handle_emulation_failure(struct kvm_vcpu *vcpu)
{ {
int r = EMULATE_DONE;
++vcpu->stat.insn_emulation_fail; ++vcpu->stat.insn_emulation_fail;
trace_kvm_emulate_insn_failed(vcpu); trace_kvm_emulate_insn_failed(vcpu);
vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR; if (!is_guest_mode(vcpu)) {
vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_EMULATION; vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
vcpu->run->internal.ndata = 0; vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_EMULATION;
vcpu->run->internal.ndata = 0;
r = EMULATE_FAIL;
}
kvm_queue_exception(vcpu, UD_VECTOR); kvm_queue_exception(vcpu, UD_VECTOR);
return EMULATE_FAIL;
return r;
} }
static bool reexecute_instruction(struct kvm_vcpu *vcpu, gva_t gva) static bool reexecute_instruction(struct kvm_vcpu *vcpu, gva_t gva)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册