[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1536220964-8412-1-git-send-email-wang.yi59@zte.com.cn>
Date: Thu, 6 Sep 2018 16:02:44 +0800
From: Yi Wang <wang.yi59@....com.cn>
To: pbonzini@...hat.com
Cc: rkrcmar@...hat.com, tglx@...utronix.de, mingo@...hat.com,
hpa@...or.com, x86@...nel.org, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, wang.yi59@....com.cn,
zhong.weidong@....com.cn, xu.xi8@....com.cn
Subject: [PATCH] KVM: x86: fix failure of injecting exceptions in x86_emulate_instruction
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@....com.cn>
Reviewed-by: Xi Xu <xu.xi8@....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
Powered by blists - more mailing lists