Skip to contentSkip to conversation

VMX: don't allow PVH to reach handle_pio() or handle_mmio()

PATCH Superseded Jan Beulich 2 participants 3 messages Dec 5, 2014 – Dec 8, 2014

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 VMX: don't allow PVH to reach handle_pio() or handle_mmio()

PVH guests are not supposed to access I/O ports they weren't given access to (there's nothing to handle emulation of such accesses).

---
Note: Only compile tested so far.

xen/arch/x86/hvm/vmx/vmx.c +3 -0
@@ -3082,6 +3082,9 @@ void vmx_vmexit_handler(struct cpu_user_
     }
 
     case EXIT_REASON_IO_INSTRUCTION:
+        if ( unlikely(is_pvh_vcpu(v)) )
+            goto exit_and_crash;
+
         __vmread(EXIT_QUALIFICATION, &exit_qualification);
         if ( exit_qualification & 0x10 )
         {

VMX: don't allow PVH to reach handle_pio() or handle_mmio()

PVH guests are not supposed to access I/O ports they weren't given access to (there's nothing to handle emulation of such accesses).

---
Note: Only compile tested so far.

xen/arch/x86/hvm/vmx/vmx.c +3 -0
@@ -3082,6 +3082,9 @@ void vmx_vmexit_handler(struct cpu_user_
     }
 
     case EXIT_REASON_IO_INSTRUCTION:
+        if ( unlikely(is_pvh_vcpu(v)) )
+            goto exit_and_crash;
+
         __vmread(EXIT_QUALIFICATION, &exit_qualification);
         if ( exit_qualification & 0x10 )
         {

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

#1 lore raw
Quoted 11 lines · On Fri, 05 Dec 2014 14:06:53 +0000 "Jan Beulich" <[email protected]> wrote:

PVH guests are not supposed to access I/O ports they weren't given access to (there's nothing to handle emulation of such accesses).

---
Note: Only compile tested so far.

xen/arch/x86/hvm/vmx/vmx.c void vmx_vmexit_handler(struct cpu_user_ · line 3090

Quoted 9 lines
xen/arch/x86/hvm/vmx/vmx.c +3 -0
@@ -3082,6 +3082,9 @@ void vmx_vmexit_handler(struct cpu_user_
     }
 
     case EXIT_REASON_IO_INSTRUCTION:
+        if ( unlikely(is_pvh_vcpu(v)) )
+            goto exit_and_crash;
+
         __vmread(EXIT_QUALIFICATION, &exit_qualification);
         if ( exit_qualification & 0x10 )
         {

Actually, handle_pio() will eventually reach handle_pvh_io() which would access check via admin_io_okay, so that path should be OK, right?

thanks,
Mukesh

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

#2 lore raw
Quoted 17 lines
Quoted 1 line
Quoted 1 line · On 06.12.14 at 02:50, <[email protected]> wrote:
Quoted 13 lines · On Fri, 05 Dec 2014 14:06:53 +0000 "Jan Beulich" <[email protected]> wrote:

PVH guests are not supposed to access I/O ports they weren't given access to (there's nothing to handle emulation of such accesses).

---
Note: Only compile tested so far.

xen/arch/x86/hvm/vmx/vmx.c +0 -0
@@ -3082,6 +3082,9 @@ void vmx_vmexit_handler(struct cpu_user_
     }
 
Quoted 11 lines

xen/arch/x86/hvm/vmx/vmx.c void vmx_vmexit_handler(struct cpu_user_ · line 3090

Quoted 7 lines
xen/arch/x86/hvm/vmx/vmx.c +3 -0
     case EXIT_REASON_IO_INSTRUCTION:
+        if ( unlikely(is_pvh_vcpu(v)) )
+            goto exit_and_crash;
+
         __vmread(EXIT_QUALIFICATION, &exit_qualification);
         if ( exit_qualification & 0x10 )
         {

Actually, handle_pio() will eventually reach handle_pvh_io() which would access check via admin_io_okay, so that path should be OK, right?

Ah, yes, at least that case was already taken care of.

Jan

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