]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
x86/pv: Correctly fold vIOPL back into vcpu_guest_context
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 11 Apr 2016 09:03:55 +0000 (10:03 +0100)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Mon, 11 Apr 2016 14:21:16 +0000 (10:21 -0400)
c/s f71ecb6 "x86: introduce a new VMASSIST for architectural behaviour of
iopl" shifted the vcpu iopl field by 12, but didn't update the logic which
reconstructs the guests eflags for migration.

Existing guest kernels set a vIOPL of 1, to prevent them from faulting when
accessing IO ports.  This bug manifests as a crash after migrate, as the vIOPL
reverts back to the default of 0, and the guest suffers an unexpected #GP
fault.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Tested-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
xen/arch/x86/domctl.c

index cba1e378d57fc00d9236288634f54d765feea4df..6e709cb69170716b877057a88e2e5a99c1927449 100644 (file)
@@ -1512,7 +1512,7 @@ void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c)
 
         /* IOPL privileges are virtualised: merge back into returned eflags. */
         BUG_ON((c(user_regs.eflags) & X86_EFLAGS_IOPL) != 0);
-        c(user_regs.eflags |= v->arch.pv_vcpu.iopl << 12);
+        c(user_regs.eflags |= v->arch.pv_vcpu.iopl);
 
         if ( !compat )
         {