|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] x86emul: avoid triggering assertions with VME/PVI early #GP check
commit 57f78a734bcabeab75ca21d4e871be78a3463fbe
Author: Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Tue Dec 18 15:21:17 2018 +0100
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Dec 18 15:21:17 2018 +0100
x86emul: avoid triggering assertions with VME/PVI early #GP check
In commit efe9cba66c ("x86emul: VME and PVI modes require a #GP(0) check
first thing") I neglected the fact that the retire flags get zapped only
in x86_decode(), which hasn't been invoked yet at the point of the #GP(0)
check added. Move output state initialization into a helper function,
and invoke it from the callers of x86_decode() instead of doing it
(possibly too late) in that function.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
xen/arch/x86/x86_emulate/x86_emulate.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c
b/xen/arch/x86/x86_emulate/x86_emulate.c
index a3d7e33385..20510151c8 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -1866,6 +1866,13 @@ static bool vcpu_has(
#define host_and_vcpu_must_have(feat) vcpu_must_have(feat)
#endif
+/* Initialise output state in x86_emulate_ctxt */
+static void init_context(struct x86_emulate_ctxt *ctxt)
+{
+ ctxt->retire.raw = 0;
+ x86_emul_reset_event(ctxt);
+}
+
static int
realmode_load_seg(
enum x86_segment seg,
@@ -2713,10 +2720,6 @@ x86_decode(
state->regs = ctxt->regs;
state->ip = ctxt->regs->r(ip);
- /* Initialise output state in x86_emulate_ctxt */
- ctxt->retire.raw = 0;
- x86_emul_reset_event(ctxt);
-
op_bytes = def_op_bytes = ad_bytes = def_ad_bytes = ctxt->addr_size/8;
if ( op_bytes == 8 )
{
@@ -3400,6 +3403,8 @@ x86_emulate(
ASSERT(ops->read);
+ init_context(ctxt);
+
generate_exception_if((mode_vif() &&
(_regs.eflags & X86_EFLAGS_VIF) &&
(_regs.eflags & X86_EFLAGS_VIP)),
@@ -9800,8 +9805,11 @@ x86_decode_insn(
.insn_fetch = insn_fetch,
.read = x86emul_unhandleable_rw,
};
- int rc = x86_decode(state, ctxt, &ops);
+ int rc;
+
+ init_context(ctxt);
+ rc = x86_decode(state, ctxt, &ops);
if ( unlikely(rc != X86EMUL_OKAY) )
return ERR_PTR(-rc);
--
generated by git-patchbot for /home/xen/git/xen.git#master
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |