[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] x86/pv: Defer I/O bitmap checks even in 64bit mode for emulate_privilege_op()



commit e5ca20e0f6212dffaba2d3a0b966b71d9ab1ea91
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Thu Jan 5 11:41:50 2017 +0000
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Thu Jan 5 12:22:55 2017 +0000

    x86/pv: Defer I/O bitmap checks even in 64bit mode for 
emulate_privilege_op()
    
    The I/O bitmap doesn't change function depending on mode.  64bit userspace
    such as an X server still needs to enter guest_io_okay() to find that the PV
    kernel did set up an appropriate virtual I/O bitmap to permit access.
    
    While moving the check, alter its representation to be easier to read.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/arch/x86/traps.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index a33109d..e45ff71 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -2169,6 +2169,19 @@ static int priv_op_read_segment(enum x86_segment seg,
                                 struct segment_register *reg,
                                 struct x86_emulate_ctxt *ctxt)
 {
+    /* Check if this is an attempt to access the I/O bitmap. */
+    if ( seg == x86_seg_tr )
+    {
+        switch ( ctxt->opcode )
+        {
+        case 0x6c ... 0x6f: /* ins / outs */
+        case 0xe4 ... 0xe7: /* in / out (immediate port) */
+        case 0xec ... 0xef: /* in / out (port in %dx) */
+            /* Defer the check to priv_op_{read,write}_io(). */
+            return X86EMUL_DONE;
+        }
+    }
+
     if ( ctxt->addr_size < 64 )
     {
         unsigned long limit;
@@ -2182,11 +2195,6 @@ static int priv_op_read_segment(enum x86_segment seg,
         case x86_seg_fs: sel = read_sreg(fs);  break;
         case x86_seg_gs: sel = read_sreg(gs);  break;
         case x86_seg_ss: sel = ctxt->regs->ss; break;
-        case x86_seg_tr:
-            /* Check if this is an attempt to access to I/O bitmap. */
-            if ( (ctxt->opcode & ~0xb) == 0xe4 || (ctxt->opcode & ~3) == 0x6c )
-                return X86EMUL_DONE;
-            /* fall through */
         default: return X86EMUL_UNHANDLEABLE;
         }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.