Skip to contentSkip to conversation

x86/pv: Fix assertion failure in pv_emulate_privileged_op()

PATCH In review Andrew Cooper 2 participants 2 messages Sep 25, 2017 – Sep 26, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/pv: Fix assertion failure in pv_emulate_privileged_op()

The ABI of {read,write}_msr() are required them to use x86_emul_hw_exception() if they raise an exception with the emulator core.

---
CC: Jan Beulich <[email protected]>

---
 xen/arch/x86/pv/emul-priv-op.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
xen/arch/x86/pv/emul-priv-op.c +10 -0
index ef13d99..dd90713 100644
@@ -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 )
     {
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 2 lines
Quoted 1 line
Quoted 1 line · On 25.09.17 at 19:19, <[email protected]> wrote:

The ABI of {read,write}_msr() are required them to use x86_emul_hw_exception()

s/are required/require/?

Quoted 1 line

if they raise an exception with the emulator core.

Perhaps better "if they report an exception to", as otherwise both parts of the sentence state the same thing (x86_emul_hw_exception() being what raises the exception).

Quoted 1 line

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel