All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: x86: fix failure of injecting exceptions in x86_emulate_instruction
@ 2018-09-06  8:02 Yi Wang
  2018-09-20 16:30 ` Paolo Bonzini
  0 siblings, 1 reply; 4+ messages in thread
From: Yi Wang @ 2018-09-06  8:02 UTC (permalink / raw)
  To: pbonzini
  Cc: rkrcmar, tglx, mingo, hpa, x86, kvm, linux-kernel, wang.yi59,
	zhong.weidong, xu.xi8

In order to fix a page table walk issue, commit 6ea6e84309ca
("KVM: x86: inject exceptions produced by x86_decode_insn") check
if variable ctxt->have_exception true and inject the exception.
Unfortunately, ctxt->have_exception is set to true only in function
x86_emulate_insn(), which won't be called before invoking
inject_emulated_exception() in the 6ea6e84309ca.
This patch fix this issue.

Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
Reviewed-by: Xi Xu <xu.xi8@zte.com.cn>
---
 arch/x86/kvm/emulate.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 106482d..aecf9a72 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -5105,8 +5105,11 @@ int x86_decode_insn(struct x86_emulate_ctxt *ctxt, void *insn, int insn_len)
 		memcpy(ctxt->fetch.data, insn, insn_len);
 	else {
 		rc = __do_insn_fetch_bytes(ctxt, 1);
-		if (rc != X86EMUL_CONTINUE)
+		if (rc != X86EMUL_CONTINUE) {
+			if (rc == X86EMUL_PROPAGATE_FAULT)
+				ctxt->have_exception = true;
 			return rc;
+		}
 	}
 
 	switch (mode) {
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-09-20 17:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-06  8:02 [PATCH] KVM: x86: fix failure of injecting exceptions in x86_emulate_instruction Yi Wang
2018-09-20 16:30 ` Paolo Bonzini
2018-09-20 16:53   ` Paolo Bonzini
2018-09-20 17:50     ` Sean Christopherson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.