]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
KVM: x86: handle SMBASE as physical address in RSM
authorRadim Krčmář <rkrcmar@redhat.com>
Fri, 30 Oct 2015 15:36:25 +0000 (16:36 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 4 Nov 2015 15:24:32 +0000 (16:24 +0100)
GET_SMSTATE depends on real mode to ensure that smbase+offset is treated
as a physical address, which has already caused a bug after shuffling
the code.  Enforce physical addressing.

Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Reported-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/emulate.c

index 9da95b9daf8deb83af606ae0fffb73f7fab74ff2..b60fed56671b87bfbfbbf95d5b66d0128e8876e3 100644 (file)
@@ -2272,8 +2272,8 @@ static int emulator_has_longmode(struct x86_emulate_ctxt *ctxt)
 #define GET_SMSTATE(type, smbase, offset)                                \
        ({                                                                \
         type __val;                                                      \
-        int r = ctxt->ops->read_std(ctxt, smbase + offset, &__val,       \
-                                    sizeof(__val), NULL);                \
+        int r = ctxt->ops->read_phys(ctxt, smbase + offset, &__val,      \
+                                     sizeof(__val));                     \
         if (r != X86EMUL_CONTINUE)                                       \
                 return X86EMUL_UNHANDLEABLE;                             \
         __val;                                                           \
@@ -2484,8 +2484,7 @@ static int em_rsm(struct x86_emulate_ctxt *ctxt)
 
        /*
         * Get back to real mode, to prepare a safe state in which to load
-        * CR0/CR3/CR4/EFER.  Also this will ensure that addresses passed
-        * to read_std/write_std are not virtual.
+        * CR0/CR3/CR4/EFER.
         *
         * CR4.PCIDE must be zero, because it is a 64-bit mode only feature.
         */