From: Andrew Cooper Date: Mon, 25 Sep 2017 17:19:01 +0000 (+0100) Subject: x86/pv: Fix assertion failure in pv_emulate_privileged_op() X-Git-Tag: 4.10.0-rc1~241^2~3 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=8a4b37c38c4be14a21556455fba9a0be5c0fe36b;p=people%2Fdariof%2Fxen.git x86/pv: Fix assertion failure in pv_emulate_privileged_op() The ABI of {read,write}_msr() requires them to use x86_emul_hw_exception() if they report an exception with the emulator core. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c index ef13d992f0..dd90713acf 100644 --- a/xen/arch/x86/pv/emul-priv-op.c +++ b/xen/arch/x86/pv/emul-priv-op.c @@ -844,7 +844,12 @@ static int read_msr(unsigned int reg, uint64_t *val, int ret; if ( (ret = guest_rdmsr(curr, reg, val)) != X86EMUL_UNHANDLEABLE ) + { + if ( ret == X86EMUL_EXCEPTION ) + x86_emul_hw_exception(TRAP_gp_fault, 0, ctxt); + return ret; + } switch ( reg ) { @@ -993,7 +998,12 @@ static int write_msr(unsigned int reg, uint64_t val, int ret; if ( (ret = guest_wrmsr(curr, reg, val)) != X86EMUL_UNHANDLEABLE ) + { + if ( ret == X86EMUL_EXCEPTION ) + x86_emul_hw_exception(TRAP_gp_fault, 0, ctxt); + return ret; + } switch ( reg ) {