[Devel] [PATCH RHEL7 COMMIT] ms/KVM: x86: Always allow access to VMware backdoor I/O ports

Konstantin Khorenko khorenko at virtuozzo.com
Tue May 8 12:26:23 MSK 2018


The commit is pushed to "branch-rh7-3.10.0-693.21.1.vz7.47.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-693.21.1.vz7.47.5
------>
commit 8cec53c42f5cafea177a7402e9cbf51e4dda9b87
Author: Liran Alon <liran.alon at oracle.com>
Date:   Tue May 8 12:26:23 2018 +0300

    ms/KVM: x86: Always allow access to VMware backdoor I/O ports
    
    VMware allows access to these ports even if denied
    by TSS I/O permission bitmap. Mimic behavior.
    
    Signed-off-by: Liran Alon <liran.alon at oracle.com>
    Reviewed-by: Nikita Leshenko <nikita.leshchenko at oracle.com>
    Reviewed-by: Radim Krčmář <rkrcmar at redhat.com>
    Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
    
    (cherry picked from commit 9a29d449e3fb704bd449b82b2160a041709a5425)
    Signed-off-by: Jan Dakinevich <jan.dakinevich at virtuozzo.com>
---
 arch/x86/kvm/emulate.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index dba1746c539c..7d486946d09c 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -2907,6 +2907,9 @@ static bool emulator_bad_iopl(struct x86_emulate_ctxt *ctxt)
 	return ctxt->ops->cpl(ctxt) > iopl;
 }
 
+#define VMWARE_PORT_VMPORT	(0x5658)
+#define VMWARE_PORT_VMRPC	(0x5659)
+
 static bool emulator_io_port_access_allowed(struct x86_emulate_ctxt *ctxt,
 					    u16 port, u16 len)
 {
@@ -2918,6 +2921,14 @@ static bool emulator_io_port_access_allowed(struct x86_emulate_ctxt *ctxt,
 	unsigned mask = (1 << len) - 1;
 	unsigned long base;
 
+	/*
+	 * VMware allows access to these ports even if denied
+	 * by TSS I/O permission bitmap. Mimic behavior.
+	 */
+	if (enable_vmware_backdoor &&
+	    ((port == VMWARE_PORT_VMPORT) || (port == VMWARE_PORT_VMRPC)))
+		return true;
+
 	ops->get_segment(ctxt, &tr, &tr_seg, &base3, VCPU_SREG_TR);
 	if (!tr_seg.p)
 		return false;


More information about the Devel mailing list