Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fc3a915

Browse filesBrowse files
joergroedelavikivity
authored andcommitted
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: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
1 parent 2030753 commit fc3a915
Copy full SHA for fc3a915

File tree

Expand file treeCollapse file tree

1 file changed

+10
-4
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+10
-4
lines changed
Open diff view settings
Collapse file

‎arch/x86/kvm/x86.c‎

Copy file name to clipboardExpand all lines: arch/x86/kvm/x86.c
+10-4Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4314,13 +4314,19 @@ EXPORT_SYMBOL_GPL(kvm_inject_realmode_interrupt);
43144314

43154315
static int handle_emulation_failure(struct kvm_vcpu *vcpu)
43164316
{
4317+
int r = EMULATE_DONE;
4318+
43174319
++vcpu->stat.insn_emulation_fail;
43184320
trace_kvm_emulate_insn_failed(vcpu);
4319-
vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
4320-
vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_EMULATION;
4321-
vcpu->run->internal.ndata = 0;
4321+
if (!is_guest_mode(vcpu)) {
4322+
vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
4323+
vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_EMULATION;
4324+
vcpu->run->internal.ndata = 0;
4325+
r = EMULATE_FAIL;
4326+
}
43224327
kvm_queue_exception(vcpu, UD_VECTOR);
4323-
return EMULATE_FAIL;
4328+
4329+
return r;
43244330
}
43254331

43264332
static bool reexecute_instruction(struct kvm_vcpu *vcpu, gva_t gva)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.